Skip to content

perf(estree/tokens): speed up JSON stringifying with raw writes#19735

Closed
overlookmotel wants to merge 1 commit intographite-base/19735from
om/02-26-perf_estree_tokens_speed_up_json_stringifying_with_raw_writes
Closed

perf(estree/tokens): speed up JSON stringifying with raw writes#19735
overlookmotel wants to merge 1 commit intographite-base/19735from
om/02-26-perf_estree_tokens_speed_up_json_stringifying_with_raw_writes

Conversation

@overlookmotel
Copy link
Member

@overlookmotel overlookmotel commented Feb 26, 2026

WIP. This optimization is (mostly) sound, but it's pretty nasty. Would be better to implement in ESTree trait methods directly, so there's no unsafe at call sites. Made this PR mostly to see what CodSpeed says (it says 🚀).

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

overlookmotel commented Feb 26, 2026

Warning

This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
Learn more


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 26, 2026

Merging this PR will improve performance by 15.98%

⚡ 1 improved benchmark
✅ 51 untouched benchmarks
⏩ 3 skipped benchmarks1

Performance Changes

Mode Benchmark BASE HEAD Efficiency
Simulation estree_tokens[checker.ts] 151.4 ms 130.6 ms +15.98%

Comparing om/02-26-perf_estree_tokens_speed_up_json_stringifying_with_raw_writes (9c71074) with om/02-22-perf_estree_tokens_use_ident_s_from_ast_for_identifier_tokens (f6e952a)

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 changed the base branch from om/02-22-perf_estree_tokens_use_ident_s_from_ast_for_identifier_tokens to graphite-base/19735 February 26, 2026 11:07
@overlookmotel overlookmotel force-pushed the om/02-26-perf_estree_tokens_speed_up_json_stringifying_with_raw_writes branch from 9c71074 to 391d516 Compare February 26, 2026 11:07
@overlookmotel
Copy link
Member Author

#19766 and #19744 achieve much of the same gain with less crazily unsafe code. This still leaves some potential perf gains on the table, but it's good enough for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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.

1 participant