Skip to content

perf(parser/tokens): pre-allocate capacity for tokens#19543

Merged
graphite-app[bot] merged 1 commit intomainfrom
om/02-19-perf_parser_tokens_pre-allocate_capacity_for_tokens
Feb 24, 2026
Merged

perf(parser/tokens): pre-allocate capacity for tokens#19543
graphite-app[bot] merged 1 commit intomainfrom
om/02-19-perf_parser_tokens_pre-allocate_capacity_for_tokens

Conversation

@overlookmotel
Copy link
Member

@overlookmotel overlookmotel commented Feb 19, 2026

Perf optimization to parsing with tokens. Pre-allocate sufficient capacity in the ArenaVec<Token> so it doesn't need to grow during the parsing process.

Up to 22% perf improvement on benchmarks for parsing with tokens.

Copy link
Member Author

overlookmotel commented Feb 19, 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.

@codspeed-hq
Copy link

codspeed-hq bot commented Feb 19, 2026

Merging this PR will improve performance by 22.2%

⚡ 4 improved benchmarks
✅ 48 untouched benchmarks
⏩ 3 skipped benchmarks1

Performance Changes

Mode Benchmark BASE HEAD Efficiency
Simulation parser_tokens[binder.ts] 4.5 ms 3.8 ms +17.67%
Simulation parser_tokens[react.development.js] 1.8 ms 1.5 ms +22.2%
Simulation parser_tokens[RadixUIAdoptionSection.jsx] 98.5 µs 94.3 µs +4.48%
Simulation parser_tokens[cal.com.tsx] 33.4 ms 30.3 ms +10.44%

Comparing om/02-19-perf_parser_tokens_pre-allocate_capacity_for_tokens (b0fa937) with om/02-18-fix_estree_tokens_generate_tokens_for_files_with_bom (142e46b)

Open in CodSpeed

Footnotes

  1. 3 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

@overlookmotel overlookmotel force-pushed the om/02-19-perf_parser_tokens_pre-allocate_capacity_for_tokens branch from 6cd4d00 to 5873776 Compare February 20, 2026 10:09
@overlookmotel overlookmotel force-pushed the om/02-18-fix_estree_tokens_generate_tokens_for_files_with_bom branch from cd4ce15 to 110cf79 Compare February 20, 2026 10:09
@overlookmotel overlookmotel force-pushed the om/02-19-perf_parser_tokens_pre-allocate_capacity_for_tokens branch from 5873776 to 9a5717b Compare February 20, 2026 11:43
@overlookmotel overlookmotel force-pushed the om/02-18-fix_estree_tokens_generate_tokens_for_files_with_bom branch from 110cf79 to 443d906 Compare February 20, 2026 11:43
@overlookmotel overlookmotel changed the base branch from om/02-18-fix_estree_tokens_generate_tokens_for_files_with_bom to graphite-base/19543 February 23, 2026 16:11
@overlookmotel overlookmotel force-pushed the om/02-19-perf_parser_tokens_pre-allocate_capacity_for_tokens branch from 9a5717b to 8afb7c5 Compare February 23, 2026 16:11
@overlookmotel overlookmotel changed the base branch from graphite-base/19543 to om/02-18-fix_estree_tokens_generate_tokens_for_files_with_bom February 23, 2026 16:11
@overlookmotel overlookmotel changed the base branch from om/02-18-fix_estree_tokens_generate_tokens_for_files_with_bom to graphite-base/19543 February 23, 2026 23:02
@graphite-app graphite-app bot force-pushed the om/02-19-perf_parser_tokens_pre-allocate_capacity_for_tokens branch from 7dde0c1 to b83934c Compare February 24, 2026 13:36
@graphite-app
Copy link
Contributor

graphite-app bot commented Feb 24, 2026

Merge activity

Perf optimization to parsing with tokens. Pre-allocate sufficient capacity in the `ArenaVec<Token>` so it doesn't need to grow during the parsing process.

Up to 22% perf improvement on benchmarks for parsing with tokens.
@graphite-app graphite-app bot force-pushed the om/02-18-fix_estree_tokens_generate_tokens_for_files_with_bom branch from d75cd3c to b2b7a55 Compare February 24, 2026 13:43
@graphite-app graphite-app bot force-pushed the om/02-19-perf_parser_tokens_pre-allocate_capacity_for_tokens branch from b83934c to 136e39b Compare February 24, 2026 13:43
Base automatically changed from om/02-18-fix_estree_tokens_generate_tokens_for_files_with_bom to main February 24, 2026 13:49
@graphite-app graphite-app bot removed the 0-merge Merge with Graphite Merge Queue label Feb 24, 2026
@graphite-app graphite-app bot merged commit 136e39b into main Feb 24, 2026
23 checks passed
@graphite-app graphite-app bot deleted the om/02-19-perf_parser_tokens_pre-allocate_capacity_for_tokens branch February 24, 2026 13:50
This was referenced Feb 24, 2026
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