Skip to content

perf: box large compilation artifacts#14699

Draft
intellild wants to merge 1 commit into
mainfrom
perf/box-large-artifacts
Draft

perf: box large compilation artifacts#14699
intellild wants to merge 1 commit into
mainfrom
perf/box-large-artifacts

Conversation

@intellild

@intellild intellild commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

What changed

This PR boxes several large compilation artifacts across async and persistent-cache boundaries so they are no longer returned or moved by value through hot paths. The main flow now carries boxed build-module-graph artifacts, exports-info artifacts, build results, parse results, code-generation results, and persistent-cache artifacts.

It also simplifies the large BindingCell constructors back to new(Box<T>), adds From<Box<T>> support where needed, and updates affected module/plugin implementations to keep large results boxed through the call chain.

A new rspack_large_stack_type dylint crate was added to catch known large Rspack types when they appear in stack-sized positions. The root lint config also enables relevant clippy/rust lints for large assignments, futures, and stack frames.

Why

These artifacts can become large enough that returning or moving them by value increases stack pressure and unnecessary data movement. Boxing them at ownership boundaries keeps async futures and compilation-stage handoffs smaller while preserving the existing ownership model.

Expected impact

The change should reduce stack usage and large moves in build-module-graph, parser/build/codegen, and persistent-cache recovery paths. It also gives future changes a guardrail so new large artifacts are passed as Box or references instead of silently growing stack frames.

Checked locally with cargo fmt --all --check, focused cargo check for core/devtool/swc-minimizer, cargo test --locked --no-run for the new dylint crate, cargo check -p rspack_benchmark --benches, and cargo check --profile codspeed -p rspack_benchmark --bench benches --bench rspack_sources. The dylint UI run reached the temporary driver stage locally, but the driver process did not complete reliably in this environment.

@github-actions

github-actions Bot commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

📦 Binary Size-limit

Comparing ac8b64a to fix(esm_library): preserve static source-phase external bindings (#14674) by Elecmonkey

🎉 Size decreased by 16.00KB from 66.74MB to 66.73MB (⬇️0.02%)

@intellild intellild force-pushed the perf/box-large-artifacts branch 2 times, most recently from 483fdd7 to 892a1cb Compare July 6, 2026 09:53
@intellild intellild force-pushed the perf/box-large-artifacts branch from 892a1cb to ac8b64a Compare July 6, 2026 11:05
@codspeed-hq

codspeed-hq Bot commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

Merging this PR will not alter performance

✅ 43 untouched benchmarks
⏩ 47 skipped benchmarks1


Comparing perf/box-large-artifacts (ac8b64a) with main (df598e4)

Open in CodSpeed

Footnotes

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

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant