Skip to content

Improve performance of variable resolver #668

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

Closed
wants to merge 1 commit into from

Conversation

bnoordhuis
Copy link
Contributor

@bnoordhuis bnoordhuis commented Nov 10, 2024

Use a LRU cache to speed up resolving variables in really large source files.

The test case from the linked issue spends about 50% of its time inside resolve_scope_var(). With this change that drops by about 20% and gives a 10% overall speedup.

Fixes: #456


I'm not completely sold on this change yet:

  1. unclear if it interacts correctly with with (but I guess CI will tell - edit: interacts poorly)

  2. adds complexity for an at best okay-ish speedup

(2) can maybe be improved by caching variables from parent function scopes as well but that gets complex fast.

Use a LRU cache to speed up resolving variables in really large source
files.

The test case from the linked issue spends about 50% of its time inside
resolve_scope_var(). With this change that drops by about 20% and gives
a 10% overall speedup.

Fixes: quickjs-ng#456
@bnoordhuis
Copy link
Contributor Author

Superseded by #672.

Kind of a shame because I rather like how the LRU code turned out. Oh well 🤷

@bnoordhuis bnoordhuis closed this Nov 12, 2024
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

Successfully merging this pull request may close these issues.

Optimising find_var / find_arg performance
1 participant