Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Template parsing performance degradation between 0.8.3.3 and 0.9.1.1 #316

Open
ugenl opened this issue Jan 25, 2025 · 9 comments
Open

Template parsing performance degradation between 0.8.3.3 and 0.9.1.1 #316

ugenl opened this issue Jan 25, 2025 · 9 comments

Comments

@ugenl
Copy link

ugenl commented Jan 25, 2025

Hi again all, back with another enormous template string and a related performance issue.

Much like the previous issue (#310), I'm using 0.8.3.3 as the previous baseline, and using the same test.

The difference here is the template string that I've attached, which is effectively one giant assign block with a ton of lookups and comparisons that are linked together by ors and ands.

Benchmarks (averaged over 100 runs):
0.8.3.3 - 0.0155 seconds
0.9.1.1 - 1.819 seconds

Also for a bit of additional information, when checking the profiler, I see very long chains (> 300) of LiquidParser.expr calls.

test_string.txt

@msangel
Copy link
Collaborator

msangel commented Jan 25, 2025

I don't know whats in that file but my text editor hangs on opening it attempts...

@msangel
Copy link
Collaborator

msangel commented Jan 25, 2025

Oh

Image

@ugenl
Copy link
Author

ugenl commented Jan 25, 2025

yeah, it's...massive. The file that held the original whole string (before anonymization and paring down) was ~2.7 MB 😬

@msangel
Copy link
Collaborator

msangel commented Jan 25, 2025

Navigating it with VIM works better then in xfce mousepad.
And it is entire expression, so not wonder LiquidParser.expr called here. Still not clear degradation reason.
With high probability will need help of @bkiers

@msangel
Copy link
Collaborator

msangel commented Jan 25, 2025

@ugenl in some of these changes new flavor was added. Could you please tell what flavor is used to parse this?
Not sure if this is important, but there definitely was some related with this changes.

@bkiers
Copy link
Owner

bkiers commented Jan 25, 2025

Navigating it with VIM works better then in xfce mousepad. And it is entire expression, so not wonder LiquidParser.expr called here. Still not clear degradation reason. With high probability will need help of @bkiers

I will have a look at this 👍

@ugenl
Copy link
Author

ugenl commented Jan 27, 2025

@ugenl in some of these changes new flavor was added. Could you please tell what flavor is used to parse this? Not sure if this is important, but there definitely was some related with this changes.

@msangel It doesn't look like we're changing flavors, so I believe we should be using the default Flavor.LIQP flavor.

@bkiers
Copy link
Owner

bkiers commented Feb 4, 2025

Apologies, I've not found the time yet. I've been busy with work. Hopefully this weekend.

@vtatai
Copy link

vtatai commented Feb 20, 2025

AFAICT from doing a bisect seems like the issue is still with the same commit as last time - I know it was fixed, but perhaps this is a more extreme scenario (?).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants