{{ message }}
Repository navigation
fix(tokenizer): avoid temporary source-line pairs - #1113
Merged
Merged
Conversation
Iterate physical lines directly instead of allocating a mapped array of line/index pairs. Add focused coverage for filtering, continuation folding, physical source locations, diagnostics and input preservation.
andorthehood
approved these changes
Oct 21, 2026
andorthehood
left a comment
Member
There was a problem hiding this comment.
Thank you for the optimization @jinchuntan !
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.

Fixes #1069.
Walks physical source lines by index instead of allocating a mapped array of line/index pairs. Comment filtering, continuation folding and physical line numbers keep their existing behavior.
Added nine focused cases covering blanks/comments, continuations, quoted semicolons, source preservation and malformed-continuation diagnostics. No snapshots changed.
Validated on Node 24.16.0:
All 869 tests passed, along with both typechecks and Biome.
Before/after preprocessing outcomes also match for 245 compiler fixtures and eight edge cases. A separate benchmark using the issue's prepared inputs gave these local medians:
Inputs contain 80% instructions, 10% comments and 10% blank lines. Timings cover only
foldArgumentContinuationLines(): four warmups, then 11 alternating before/after samples, averaging 20 calls per sample at 1k/10k lines and two at 100k. No timing thresholds were added to tests.