Replace Chevrotain parser with 42x faster single-pass parser#37
Merged
Conversation
This replaces the Chevrotain-based parser with a hand-optimized single-pass parser that is 11.7x faster than the legacy xcode package and 42x faster than the previous Chevrotain implementation. Performance improvements: - Throughput: 7.5 MB/s → 315 MB/s (42x improvement) - react-native fixture (29KB): 2.47ms → 120µs (20x faster) - swift-protobuf fixture (263KB): 33ms → 800µs (41x faster) Key optimizations: - Single-pass parsing without CST intermediate representation - Pre-computed lookup tables (Uint8Array) for character classification - Char code comparisons instead of string operations - Fast path for strings without escape sequences - Direct object construction without visitor pattern overhead Additional improvements: - Better error messages with line and column numbers - Handles all edge cases that crash the legacy xcode package - Added benchmark suite (bun run bench) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add performance comparison table showing 11x speedup vs legacy xcode - Document benchmark command (bun run bench) - Update solution section to reflect new parser architecture - Check off benchmarks in TODO list Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
7721188 to
4cf05f9
Compare
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.
Summary
xcodenpm packagebun run bench)Performance
vs Legacy
xcodePackageKey Optimizations
Uint8Array)Additional Improvements
Test plan
🤖 Generated with Claude Code