perf: optimize advance() with lazy line/column tracking#148
Merged
bartveneman merged 1 commit intomainfrom Feb 26, 2026
Merged
Conversation
- Replace per-character column tracking with lazy computation via getter - Inline newline check using char_types bitmask to avoid function call - Add seek() method for encapsulated lexer repositioning - Update all sub-parsers to use seek() instead of direct property writes Column is now computed as `pos - _line_offset + 1` only when accessed, eliminating column++ on ~99% of characters (non-newlines). Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
b464b46 to
de388a6
Compare
Bundle ReportChanges will increase total bundle size by 6 bytes (0.0%) ⬆️. This is within the configured threshold ✅ Detailed changes
Affected Assets, Files, and Routes:view changes for bundle: @projectwallace/css-parser-esmAssets Changed:
Files in
Files in
Files in
Files in
Files in
Files in
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #148 +/- ##
==========================================
- Coverage 94.96% 94.87% -0.09%
==========================================
Files 16 16
Lines 2721 2714 -7
Branches 712 712
==========================================
- Hits 2584 2575 -9
- Misses 137 139 +2 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
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.
Column is now computed as
pos - _line_offset + 1only when accessed, eliminating column++ on ~99% of characters (non-newlines).