Skip to content

Conversation

@Boshen
Copy link
Member

@Boshen Boshen commented Oct 7, 2025

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.

Copilot AI review requested due to automatic review settings October 7, 2025 10:28
@graphite-app
Copy link
Contributor

graphite-app bot commented Oct 7, 2025

How to use the Graphite Merge Queue

Add either label to this PR to merge it via the merge queue:

  • 0-merge - adds this PR to the back of the merge queue
  • hotfix - for urgent hot fixes, skip the queue and merge this PR next

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.

@github-actions github-actions bot added A-parser Area - Parser C-performance Category - Solution not expected to change functional behavior, only performance labels Oct 7, 2025
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@Boshen Boshen force-pushed the perf/inline-escaped-keyword-check branch from 344a905 to 2b43047 Compare October 7, 2025 10:31
@codspeed-hq
Copy link

codspeed-hq bot commented Oct 7, 2025

CodSpeed Performance Report

Merging #14408 will not alter performance

Comparing perf/inline-escaped-keyword-check (1f5167a) with main (6e8d2f6)1

Summary

✅ 37 untouched

Footnotes

  1. No successful run was found on main (ec02fe8) during the generation of this report, so 6e8d2f6 was used instead as the comparison base. There might be some changes unrelated to this pull request in this report.

@overlookmotel
Copy link
Member

Nice!

bench

@Boshen Boshen added the 0-merge Merge with Graphite Merge Queue label Oct 7, 2025
Copy link
Member Author

Boshen commented Oct 7, 2025

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.
@graphite-app graphite-app bot force-pushed the perf/inline-escaped-keyword-check branch from 2b43047 to 1f5167a Compare October 7, 2025 11:14
@graphite-app graphite-app bot merged commit 1f5167a into main Oct 7, 2025
28 checks passed
@graphite-app graphite-app bot deleted the perf/inline-escaped-keyword-check branch October 7, 2025 11:19
@graphite-app graphite-app bot removed the 0-merge Merge with Graphite Merge Queue label Oct 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-parser Area - Parser C-performance Category - Solution not expected to change functional behavior, only performance

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants