Conversation
Save completed searches in LocalGraph and reuse them when finding which assignments reach a local variable read. Stop searching earlier blocks when a saved result is available and no assignment in the block overrides it. Save results only after the search finishes so loops cannot reuse incomplete results. Apply this to both eager and lazy local variable analysis. Add tests for loops, overwritten locals, initial values, unreachable code, and different query orders.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Related #7644 and potentially fixes (?) #7319
wasm-opton my tree-sitter grammar takes more than 10 minutes, this is due to repeated searches through the same blocks during local variable analysis as profiling pointed out tossa-nomergetaking up 98%+ of cpu time.This change reuses completed results. On my file, -Os went from about 10 minutes to 6-7 seconds, with byte-for-byte identical output, this is a slop fix so I'm kinda being a meat proxy here, sorry (was asked to open the PR so I did).
Steps to reproduce
git clone https://github.com/usagi-coffee/tree-sitter-abl --depth=2 cd tree-sitter-abl tree-sitter build -wor pickup a
.wasmfile from releases and runwasm-opton it w/-Os.