Skip to content

Conversation

@Boshen
Copy link
Member

@Boshen Boshen commented Oct 7, 2025

Summary

Cache the token.has_separator() result in parse_literal_number() and parse_literal_bigint() to avoid redundant memory reads on the hot path.

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

Optimize numeric literal parsing by caching the has_separator() result to eliminate redundant memory reads and pointer arithmetic operations.

  • Cache token.has_separator() result in local variable instead of calling it multiple times
  • Apply optimization to both parse_literal_number() and parse_literal_bigint() functions
  • Reduce memory access overhead on the hot path for parsing millions of numeric literals

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

@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
@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

  • Oct 7, 9:10 AM UTC: The merge label '0-merge' was detected. This PR will be added to the Graphite merge queue once it meets the requirements.
  • Oct 7, 9:13 AM UTC: Boshen added this pull request to the Graphite merge queue.
  • Oct 7, 9:18 AM UTC: The Graphite merge queue couldn't merge this PR because it was not satisfying all requirements (Failed CI: 'Test NAPI').

@codspeed-hq
Copy link

codspeed-hq bot commented Oct 7, 2025

CodSpeed Performance Report

Merging #14403 will not alter performance

Comparing perf/cache-has-separator-in-literal-parsing (29fa3a9) with main (bce31b5)

Summary

✅ 37 untouched

## Summary

Cache the `token.has_separator()` result in `parse_literal_number()` and `parse_literal_bigint()` to avoid redundant memory reads on the hot path.
@graphite-app graphite-app bot force-pushed the perf/cache-has-separator-in-literal-parsing branch from 537076e to 29fa3a9 Compare October 7, 2025 09:14
@graphite-app graphite-app bot removed the 0-merge Merge with Graphite Merge Queue label Oct 7, 2025
@Boshen Boshen merged commit 266b982 into main Oct 7, 2025
26 of 27 checks passed
@Boshen Boshen deleted the perf/cache-has-separator-in-literal-parsing branch October 7, 2025 09:20
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