Skip to content

Conversation

@Boshen
Copy link
Member

@Boshen Boshen commented Oct 7, 2025

Summary

Add separate token kinds (DecimalBigInt, BinaryBigInt, OctalBigInt, HexBigInt) to eliminate the ends_with('n') string check when parsing BigInt literals.

Copilot AI review requested due to automatic review settings October 7, 2025 09:22
@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
@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.

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 adds separate token kinds for BigInt literals to eliminate string suffix checking during parsing. The lexer now directly communicates BigInt vs Number types through the token kind, improving performance by replacing string operations with enum comparisons.

Key changes:

  • Added four new Kind enum variants for BigInt literals (DecimalBigInt, BinaryBigInt, OctalBigInt, HexBigInt)
  • Updated lexer logic to return BigInt-specific kinds when 'n' suffix is detected
  • Modified parser to match on BigInt kinds instead of performing string suffix checks

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
crates/oxc_parser/src/lexer/kind.rs Added new BigInt token kinds and updated is_number() method
crates/oxc_parser/src/lexer/numeric.rs Modified lexer to return BigInt kinds when 'n' suffix is consumed
crates/oxc_parser/src/js/expression.rs Updated parser to match BigInt kinds directly instead of string checking

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@codspeed-hq
Copy link

codspeed-hq bot commented Oct 7, 2025

CodSpeed Performance Report

Merging #14405 will not alter performance

Comparing perf/add-bigint-token-kinds (791c72a) with main (266b982)1

Summary

✅ 37 untouched

Footnotes

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

@Boshen Boshen closed this Oct 7, 2025
@Boshen Boshen reopened this Oct 7, 2025
@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

Add separate token kinds (`DecimalBigInt`, `BinaryBigInt`, `OctalBigInt`, `HexBigInt`) to eliminate the `ends_with('n')` string check when parsing BigInt literals.
@graphite-app graphite-app bot force-pushed the perf/add-bigint-token-kinds branch from 531e558 to 791c72a Compare October 7, 2025 09:55
@graphite-app graphite-app bot merged commit 791c72a into main Oct 7, 2025
27 checks passed
@graphite-app graphite-app bot deleted the perf/add-bigint-token-kinds branch October 7, 2025 10:01
@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.

2 participants