Skip to content

perf(parser): remove branches from finish_next_inner#19695

Merged
graphite-app[bot] merged 1 commit intomainfrom
om/02-24-perf_parser_remove_branches_from_finish_next_inner_
Feb 25, 2026
Merged

perf(parser): remove branches from finish_next_inner#19695
graphite-app[bot] merged 1 commit intomainfrom
om/02-24-perf_parser_remove_branches_from_finish_next_inner_

Conversation

@overlookmotel
Copy link
Member

@overlookmotel overlookmotel commented Feb 24, 2026

Remove the !matches!(token.kind(), Kind::Eof | Kind::HashbangComment) check from Lexer::finish_next_inner.

Instead:

  1. Avoid adding a HashbangComment token in the first place by altering Lexer::first_token (hashbang is always the first token in a file).
  2. Pop off the Eof token at the very end (Eof token is always the last).

This streamlines this very hot path (called for every single token).

@github-actions github-actions bot added the A-parser Area - Parser label Feb 24, 2026
@github-actions github-actions bot added the C-performance Category - Solution not expected to change functional behavior, only performance label Feb 24, 2026
This was referenced Feb 24, 2026
Copy link
Member Author

overlookmotel commented Feb 24, 2026


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.

This stack of pull requests is managed by Graphite. Learn more about stacking.

@overlookmotel overlookmotel marked this pull request as ready for review February 24, 2026 22:10
Copilot AI review requested due to automatic review settings February 24, 2026 22:10
@overlookmotel overlookmotel self-assigned this Feb 24, 2026
@overlookmotel overlookmotel marked this pull request as ready for review February 25, 2026 00:06
@overlookmotel overlookmotel added A-linter-plugins Area - Linter JS plugins 0-merge Merge with Graphite Merge Queue labels Feb 25, 2026
Copy link
Member Author

overlookmotel commented Feb 25, 2026

Merge activity

Remove the `!matches!(token.kind(), Kind::Eof | Kind::HashbangComment)` check from `Lexer::finish_next_inner`.

Instead:

1. Avoid adding a `HashbangComment` token in the first place by altering `Lexer::first_token` (hashbang is always the first token in a file).
2. Pop off the `Eof` token at the very end (`Eof` token is always the last).

This streamlines this very hot path (called for every single token).
@graphite-app graphite-app bot force-pushed the om/02-24-refactor_parser_remove_const_generic_param_from_finish_next_inner_ branch from ac33e76 to b5d9845 Compare February 25, 2026 00:08
@graphite-app graphite-app bot force-pushed the om/02-24-perf_parser_remove_branches_from_finish_next_inner_ branch from 1eac4b3 to 7233548 Compare February 25, 2026 00:08
Base automatically changed from om/02-24-refactor_parser_remove_const_generic_param_from_finish_next_inner_ to main February 25, 2026 00:14
@graphite-app graphite-app bot removed the 0-merge Merge with Graphite Merge Queue label Feb 25, 2026
@graphite-app graphite-app bot merged commit 7233548 into main Feb 25, 2026
23 checks passed
@graphite-app graphite-app bot deleted the om/02-24-perf_parser_remove_branches_from_finish_next_inner_ branch February 25, 2026 00:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-linter-plugins Area - Linter JS plugins 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