Skip to content

perf(formatter_core): share one thread-cached scratch vector across staging buffers#24583

Merged
graphite-app[bot] merged 1 commit into
mainfrom
07-16-perf_formatter_core_share_one_thread-cached_scratch_vector_across_staging_buffers
Jul 22, 2026
Merged

perf(formatter_core): share one thread-cached scratch vector across staging buffers#24583
graphite-app[bot] merged 1 commit into
mainfrom
07-16-perf_formatter_core_share_one_thread-cached_scratch_vector_across_staging_buffers

Conversation

@leaysgur

@leaysgur leaysgur commented Jul 16, 2026

Copy link
Copy Markdown
Member

Apply #24539, share ScratchBuffer's buffer.

NOTE: checked-in vectors keep their high-water capacity for the thread's lifetime (same policy as #24539). This is ~KB for regular sources, and fine.

leaysgur commented Jul 16, 2026

Copy link
Copy Markdown
Member Author

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 changes, fast-track this PR to the front of the merge queue

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

codspeed-hq Bot commented Jul 16, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 57 untouched benchmarks
⏩ 19 skipped benchmarks1


Comparing 07-16-perf_formatter_core_share_one_thread-cached_scratch_vector_across_staging_buffers (c3b460b) with 07-16-perf_formatter_core_stage_ir_buffers_on_the_heap_to_reduce_arena_memory (c880bce)2

Open in CodSpeed

Footnotes

  1. 19 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.

  2. No successful run was found on 07-16-perf_formatter_core_stage_ir_buffers_on_the_heap_to_reduce_arena_memory (d7cedab) during the generation of this report, so 691cfca was used instead as the comparison base. There might be some changes unrelated to this pull request in this report.

@leaysgur
leaysgur force-pushed the 07-16-perf_formatter_core_stage_ir_buffers_on_the_heap_to_reduce_arena_memory branch from aa1921c to 12a1158 Compare July 17, 2026 06:03
@leaysgur
leaysgur force-pushed the 07-16-perf_formatter_core_share_one_thread-cached_scratch_vector_across_staging_buffers branch from 72ae10f to c835270 Compare July 17, 2026 06:03
@leaysgur
leaysgur force-pushed the 07-16-perf_formatter_core_share_one_thread-cached_scratch_vector_across_staging_buffers branch from c835270 to 7aa30a3 Compare July 21, 2026 06:11
@leaysgur
leaysgur force-pushed the 07-16-perf_formatter_core_stage_ir_buffers_on_the_heap_to_reduce_arena_memory branch from 12a1158 to 8039aca Compare July 21, 2026 06:11
@leaysgur
leaysgur force-pushed the 07-16-perf_formatter_core_stage_ir_buffers_on_the_heap_to_reduce_arena_memory branch from 8039aca to c880bce Compare July 21, 2026 09:26
@leaysgur
leaysgur force-pushed the 07-16-perf_formatter_core_share_one_thread-cached_scratch_vector_across_staging_buffers branch from 7aa30a3 to a9a2c78 Compare July 21, 2026 09:26
@leaysgur
leaysgur force-pushed the 07-16-perf_formatter_core_stage_ir_buffers_on_the_heap_to_reduce_arena_memory branch from c880bce to d7cedab Compare July 22, 2026 05:04
@leaysgur
leaysgur force-pushed the 07-16-perf_formatter_core_share_one_thread-cached_scratch_vector_across_staging_buffers branch from a9a2c78 to c3b460b Compare July 22, 2026 05:04
@graphite-app graphite-app Bot added the 0-merge Merge with Graphite Merge Queue label Jul 22, 2026
@graphite-app

graphite-app Bot commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

Merge activity

…taging buffers (#24583)

Apply #24539, share `ScratchBuffer`'s buffer.

NOTE: checked-in vectors keep their high-water capacity for the thread's lifetime (same policy as #24539). This is ~KB for regular sources, and fine.
@graphite-app
graphite-app Bot force-pushed the 07-16-perf_formatter_core_stage_ir_buffers_on_the_heap_to_reduce_arena_memory branch from d7cedab to c191f51 Compare July 22, 2026 06:32
@graphite-app
graphite-app Bot force-pushed the 07-16-perf_formatter_core_share_one_thread-cached_scratch_vector_across_staging_buffers branch from c3b460b to 7810e8a Compare July 22, 2026 06:32
Base automatically changed from 07-16-perf_formatter_core_stage_ir_buffers_on_the_heap_to_reduce_arena_memory to main July 22, 2026 06:36
@graphite-app graphite-app Bot removed the 0-merge Merge with Graphite Merge Queue label Jul 22, 2026
@graphite-app
graphite-app Bot merged commit 7810e8a into main Jul 22, 2026
32 checks passed
@graphite-app
graphite-app Bot deleted the 07-16-perf_formatter_core_share_one_thread-cached_scratch_vector_across_staging_buffers branch July 22, 2026 06:37
graphite-app Bot pushed a commit that referenced this pull request Jul 23, 2026
Revert #24583.

After re-measuring, I found no significant improvement. It is not worth the amount of code required.

Also, the fundamental issue is that the end-side formatter, rather than Oxfmt itself, is performing cross-file caching, which is an undesirable side effect.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-formatter Area - Formatter

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant