Repository navigation
Speed up identifier and keyword lexing - #29463
charliermarsh wants to merge 8 commits into
Conversation
Memory usage reportMemory usage unchanged ✅ |
|
|
Merging this PR will improve performance by 4.7%
Performance Changes
Tip Curious why performance improved? Comment Comparing Footnotes
|
a1177bd to
f91d049
Compare
ea02032 to
d47bd15
Compare
d47bd15 to
03bf69f
Compare
There was a problem hiding this comment.
I haven't looked at this in detail but it feels tricky to maintain (at least as it is now). I think we need some more documentation with guidance on how it works and what needs changing and how when adding/removing/changing keywords). Better isolation by e.g. encapsulating some into its own function might also help
|
why? |
|
I got the vibe from your comments that you didn't want to proceed with it haha! Do you think it's salvageable? I'm happy to clean it up, I just thought you were left feeling like the tradeoffs weren't right. |
|
I think it's a worthwhile change. I just think it requires some more explanation of what happens here and how to update that weird constant when adding/removing kewyords 😆 |
|
Haha ok. I will clean it up. I'll ask Codex to make it even weirder and more confusing. |
Summary
We scan ASCII identifier continuations in sixteen-byte batches using a byte lookup table, avoiding per-character decoding. Keyword lookup filters by length and initial byte, then uses a compact hash table with a full-word comparison to reject collisions. Non-ASCII suffixes retain the existing Unicode path.