Skip to content

perf(diagnostics): inline OxcDiagnosticInner to avoid heap allocation#22406

Merged
graphite-app[bot] merged 1 commit into
mainfrom
perf/inline-oxc-diagnostic
May 14, 2026
Merged

perf(diagnostics): inline OxcDiagnosticInner to avoid heap allocation#22406
graphite-app[bot] merged 1 commit into
mainfrom
perf/inline-oxc-diagnostic

Conversation

@Boshen

@Boshen Boshen commented May 14, 2026

Copy link
Copy Markdown
Member

Box<OxcDiagnosticInner> were added before our removal of Result<T, Error> from parser, it's no longer needed.

@codspeed-hq

codspeed-hq Bot commented May 14, 2026

Copy link
Copy Markdown

Merging this PR will degrade performance by 3.76%

❌ 2 regressed benchmarks
✅ 46 untouched benchmarks
⏩ 3 skipped benchmarks1

Warning

Please fix the performance issues or acknowledge them on CodSpeed.

Performance Changes

Mode Benchmark BASE HEAD Efficiency
Simulation parser[RadixUIAdoptionSection.jsx] 81 µs 84.4 µs -4.09%
Simulation semantic[cal.com.tsx] 21.1 ms 21.9 ms -3.42%

Tip

Investigate this regression by commenting @codspeedbot fix this regression on this PR, or directly use the CodSpeed MCP with your agent.


Comparing perf/inline-oxc-diagnostic (2201b0d) with main (2be5526)

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.

@github-actions github-actions Bot added the A-parser Area - Parser label May 14, 2026
@Boshen Boshen force-pushed the perf/inline-oxc-diagnostic branch from e949e1d to 2201b0d Compare May 14, 2026 08:12
@Boshen Boshen added the 0-merge Merge with Graphite Merge Queue label May 14, 2026

Boshen commented May 14, 2026

Copy link
Copy Markdown
Member Author

Merge activity

…on (#22406)

`Box<OxcDiagnosticInner>` were added before our removal of `Result<T, Error>` from parser, it's no longer needed.
@graphite-app graphite-app Bot force-pushed the perf/inline-oxc-diagnostic branch from 2201b0d to 618bc76 Compare May 14, 2026 08:21
@graphite-app graphite-app Bot merged commit 618bc76 into main May 14, 2026
28 checks passed
@graphite-app graphite-app Bot removed the 0-merge Merge with Graphite Merge Queue label May 14, 2026
@graphite-app graphite-app Bot deleted the perf/inline-oxc-diagnostic branch May 14, 2026 08:25
overlookmotel added a commit that referenced this pull request May 15, 2026
### 🚀 Features

- bc91a17 codegen: Expose `Codegen::with_source_type` method (#22432)
(camc314)

### 🐛 Bug Fixes

- 5ac7e79 minifier: Drop unused-var-init pure IIFEs and preserve
annotation for downstream (#22349) (Dunqing)
- 4ab57eb allocator: Fixed-size allocators use `VirtualAlloc` on Windows
(#22124) (overlookmotel)
- 66d77eb allocator: Fix segfault on Linux MUSL with fixed-size
allocators (#22388) (overlookmotel)
- b8fbc1f transformer/object-rest-spread: Correct scope id when moving
bindings (#22419) (camc314)
- 18edc2c codegen: Keep `Object.defineProperty` property name as plain
string in minify (#22400) (Dunqing)
- dda33de transformer/explicit-resource-management: Align lexical
binding scopes (#22320) (camc314)
- 8e79de8 transformer: Preserve for-await statement bodies (#22361)
(camc314)
- 0cba210 transformer/class: Replace `new.target` in static blocks
(#22360) (camc314)
- 67ab1c9 transformer/es2018/for-await: Hoist for-await generated
bindings (#22355) (camc314)
- c3ceb4a transformer/object-rest-spread: Use hoisted scope for `for-of`
temp refs (#22347) (camc314)

### ⚡ Performance

- 73a9043 allocator/bitset: Avoid temp heap `String` allocation (#22403)
(camc314)
- 8b2f4f9 transformer/object-rest-spread: Collect `Vec<SymbolId` over
`Vec<BindingIdentifier>` (#22418) (camc314)
- 83679ea parser: Split TriviaBuilder::handle_token hot/cold paths
(#22415) (Boshen)
- 2c7d781 codegen: Inline identifier-name accessors (#22411) (Boshen)
- 618bc76 diagnostics: Inline `OxcDiagnosticInner` to avoid heap
allocation (#22406) (Boshen)
- 0b4e158 parser: Reserve cap `2` for sequence expressions vec (#22374)
(camc314)
- 5f3bdd0 codegen: Add `#[inline]` to `code`, `code_len` (#22373)
(camc314)

Co-authored-by: overlookmotel <557937+overlookmotel@users.noreply.github.com>
graphite-app Bot pushed a commit that referenced this pull request May 28, 2026
## Summary

`cargo coverage` (a.k.a. `just c`) crashes locally on macOS with `fatal runtime error: stack overflow` while running `semantic_typescript` on `typescript/tests/cases/compiler/binderBinaryExpressionStressJs.ts`. That fixture builds a ~1500-deep left-leaning `BinaryExpression` chain (`0 + 1 + 2 + ... + 1499`).

macOS's `std::thread` default stack is 2 MB; Linux is 8 MB, which is why CI doesn't see this. The file used to fit because `OxcDiagnostic` was 8 bytes (`Box<OxcDiagnosticInner>`); after #22406 inlined the ~200-byte inner, every recursive frame holding a diagnostic grew, pushing past 2 MB on macOS.

This sets the rayon pool's `stack_size` to 8 MB to match Linux's default. Scope is limited to the dev coverage task — the perf win from #22406 is preserved, and no runtime consumers (parser, semantic, oxlint, oxfmt) are affected.

Verified `just c` runs end-to-end on macOS after the change.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-parser Area - Parser

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant