perf(estree/tokens): replace hash map with Vec#19718
Merged
graphite-app[bot] merged 1 commit intomainfrom Feb 25, 2026
Merged
Conversation
This was referenced Feb 25, 2026
Member
Author
This was referenced Feb 25, 2026
05dc0d8 to
7ab438c
Compare
37b6fbe to
7577c8f
Compare
7577c8f to
b9d2443
Compare
7ab438c to
6d1d3a3
Compare
6d1d3a3 to
25bbf94
Compare
Contributor
Merge activity
|
AST walk happens in source code order, so we don't need a hashmap for storing token kind overrides. We can instead use a `Vec`. The `Vec` gets filled in ascending order of span start, and then is consumed in the 2nd pass in ascending order as well. Iterating over a `Vec` in first-to-last order is much cheaper than a series of hashmap lookups which have a scattered read pattern.
25bbf94 to
dac14be
Compare
This was referenced Feb 26, 2026
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.

AST walk happens in source code order, so we don't need a hashmap for storing token kind overrides. We can instead use a
Vec. TheVecgets filled in ascending order of span start, and then is consumed in the 2nd pass in ascending order as well.Iterating over a
Vecin first-to-last order is much cheaper than a series of hashmap lookups which have a scattered read pattern.