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.
graphite-app Bot pushed a commit that referenced this pull request Jul 27, 2026
# Oxlint
### 🚀 Features

- 8d31dfa linter: Verify eslint/no-restricted-globals config schema (#24598) (vigneshwar)
- 7069621 linter: Verify jest/vitest prefer-lowercase-title config schema (#24724) (Bartok)
- 016cf2a linter/oxc: Add bad-match-all-arg rule (#24900) (camc314)
- cdc941e linter/n: Implement `exports-style` rule (#24087) (Mikhail Baev)
- 1ad6f6c linter/eslint: Implement `id-denylist` rule (#24632) (Mikhail Baev)
- 678bbb5 linter/typescript-eslint: Implement suggestion for `class-literal-property-style` rule (#24766) (Mikhail Baev)

### 🐛 Bug Fixes

- a5f3a0e linter: Mark missing suggestions as pending (#24956) (Mikhail Baev)
- a065946 oxlint: Absolutize explicit CLI paths even with --no-ignore (#24646) (Bez Sahara)
- 17688bb linter/jsx-a11y/interactive-supports-focus: Match eslint behavior for custom components (#24780) (Cole Ellison)
- 0aef19e linter/typescript/no-confusing-non-null-assertion: Report `in` and `instanceof` (#24825) (Mikhail Baev)
- 361dce9 linter: Unicorn/no-array-reverse and no-array-sort replacements should be suggestions (#24848) (klem)
- 9213560 config: Preserve defineConfig field JSDoc (#24326) (周星星同学)
- 334d884 linter/node/no-top-level-await: Clarify diagnostic (#24803) (camc314)
- b9fc6af linter/eslint/func-names: Ignore overloads (#24801) (camc314)
- e80574f estree: Handle empty spans serializing `ImportMeta` and `NewTarget` (#24775) (overlookmotel)

### ⚡ Performance

- c75dc60 linter: Avoid `Vec` allocations via `bound_names` (#24959) (connorshea)
- 9f9f39d linter/eslint/no-const-assign: Avoid `Vec` allocation per `const` declarator (#24953) (connorshea)
- 10a621e linter/typescript/adjacent-overload-signatures: Avoid collecting vec in some cases (#24874) (connorshea)
- ed167e1 linter/node/exports-style: Iterate once over global references (#24877) (connorshea)
- 69908fe linter: Avoid allocations in jest/no-deprecated-functions (#24866) (Connor Shea)
- a3585d7 linter: Speed up jest/vitest prefer-each (#24872) (Connor Shea)
- 62fe640 linter/eslint/prefer-rest-params: Run once per file (#24873) (Connor Shea)
- 7a7aa54 linter/eslint/no-this-before-super: Skip files without classes (#24869) (Connor Shea)
- 4ad0c94 linter/plugins: Faster copying comments to JS allocator (#24858) (overlookmotel)
- 4c25b91 linter/plugins: Test booleans with explicit `=== false` (#24830) (overlookmotel)
- b7add00 linter/plugins: Remove check in loop in `getDisableDirectives` (#24833) (overlookmotel)

### 📚 Documentation

- 3ff2e0e linter: Clarify config extends types (#24936) (Boshen)
# Oxfmt
### 🚀 Features

- eabfe01 oxfmt/lsp: Support `oxc.fmt.disableNestedConfig` (#24965) (leaysgur)
- 2357a10 formatter_yaml: Implement YAML formatter (#24534) (leaysgur)

### 🐛 Bug Fixes

- 761a882 formatter_css: Keep leading `+` in An+B to enable idempotency check (#24973) (leaysgur)
- e037709 formatter: Stop preserving indent for embedded template exprs (#24972) (leaysgur)
- ae1a39b formatter_css: Align wrapped selector-arg indent (#24971) (leaysgur)
- 143fd1f formatter: Align quoted `new` signature (#24883) (leaysgur)
- 07ff12f formatter_yaml: Fix indent, blank, and spacing issues (#24837) (leaysgur)
- d076b40 formatter: Check calee chain is_simple (#24871) (leaysgur)
- fb34196 formatter_css: Keep non-ASCII strings with quotes (#24870) (leaysgur)
- 9213560 config: Preserve defineConfig field JSDoc (#24326) (周星星同学)
- 31783e9 formatter_css: Print nested SCSS map with consistent indent (#24789) (leaysgur)
- 8eb9eca formatter/jsdoc: Respect `singleQuote` option in `@import` (#24787) (leaysgur)
- 6f05ac4 formatter: Fix template literal formatting (#24786) (leaysgur)

### ⚡ Performance

- bb73b23 formatter_core: Bound the thread-local scratch cache (#24793) (leaysgur)
- a5f7b15 formatter: Stage assignment-like left hand side on the heap (#24613) (leaysgur)
- 94de05f formatter: Accumulate JSX child-list builders on the heap (#24585) (leaysgur)
- 7810e8a formatter_core: Share one thread-cached scratch vector across staging buffers (#24583) (leaysgur)
- c191f51 formatter_core: Stage IR buffers on the heap to reduce arena memory (#24582) (leaysgur)

### 📚 Documentation

- 69126a0 formatter_css,fomatter_graphql,formatter_yaml: Update AGENTS.md (#24821) (leaysgur)
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