perf(parser): inline escaped keyword check in advance()#14408
perf(parser): inline escaped keyword check in advance()#14408graphite-app[bot] merged 1 commit intomainfrom
Conversation
How to use the Graphite Merge QueueAdd either label to this PR to merge it via the merge queue:
You must have a Graphite account in order to use the merge queue. Sign up using this link. An organization admin has enabled the Graphite Merge Queue in this repository. Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue. |
There was a problem hiding this comment.
Pull Request Overview
This PR optimizes the parser's token advance method by inlining an escaped keyword check and refactors BigInt literal handling to use separate token kinds instead of runtime string inspection.
- Inlined escaped keyword check directly into
advance()method to eliminate function call overhead - Added dedicated BigInt token kinds (
DecimalBigInt,BinaryBigInt, etc.) for better type safety - Moved error handling to a
#[cold]function to optimize instruction layout for the common case
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| crates/oxc_parser/src/cursor.rs | Inlines escaped keyword check in advance() and extracts error handling |
| crates/oxc_parser/src/lexer/kind.rs | Adds new BigInt token kinds and updates related methods |
| crates/oxc_parser/src/lexer/numeric.rs | Updates numeric parsing to use new BigInt token kinds |
| crates/oxc_parser/src/js/expression.rs | Refactors BigInt literal parsing to use dedicated token kinds |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
344a905 to
2b43047
Compare
CodSpeed Performance ReportMerging #14408 will not alter performanceComparing Summary
Footnotes |
Merge activity
|
## Summary Manually inline the escaped keyword check directly into `advance()` instead of calling a separate `test_escaped_keyword()` function. This eliminates function call overhead on every token advance.
2b43047 to
1f5167a
Compare

Summary
Manually inline the escaped keyword check directly into
advance()instead of calling a separatetest_escaped_keyword()function. This eliminates function call overhead on every token advance.