Skip to content

Cache bundle analysis per output file - #100475

Merged
wbinnssmith merged 4 commits into
canaryfrom
codex/analyze-compressed-size-cache
Oct 23, 2026
Merged

wbinnssmith merged 4 commits into
canaryfrom
codex/analyze-compressed-size-cache

Conversation

@wbinnssmith

@wbinnssmith wbinnssmith commented Oct 20, 2026 •

Copy link
Copy Markdown
Member

Summary

Analyze each emitted and traced file once in a cached task that returns its filename, chunk membership, and chunk parts with normalized sources and compressed sizes. Routes previously made 3–5 task calls per shared file, and task-graph bookkeeping for those calls dominated analysis. Splitting, compression, and membership enumeration run as plain helpers under that task, since each is read once.

Measured on v0/chat with next build --analyze (#99962), analysis phase only: new tasks went from 269k to 242k, calls into existing tasks from 8.49M to 5.07M, and median CPU time from 150s to 124s. All 455 data artifacts were byte-identical across 12 runs.

Supersedes #100486.

Verification

  • cargo test -p turbopack-analyze --test split_chunk and cargo test -p next-api --lib analyze passed.
  • Rebuilt the native binding with release-with-debug, installed it in v0/chat, and compared next build --analyze output against the previous binary across alternating runs.

@wbinnssmith
wbinnssmith added this pull request to stack #100476 October 20, 2026 22:35
@github-actions

github-actions Bot commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

Tests Passed

Commit: 33c5747

@github-actions github-actions Bot added created-by: Turbopack team PRs by the Turbopack team. Turbopack Related to Turbopack with Next.js. labels Oct 20, 2026
Comment thread turbopack/crates/turbopack-analyze/tests/split_chunk.rs Outdated
@wbinnssmith
wbinnssmith marked this pull request as ready for review October 20, 2026 22:49
Comment thread turbopack/crates/turbopack-analyze/src/split_chunk.rs Outdated
@wbinnssmith
wbinnssmith removed this pull request from stack #100476 October 20, 2026 23:55
@wbinnssmith
wbinnssmith added this pull request to stack #100487 October 20, 2026 23:55
@wbinnssmith
wbinnssmith force-pushed the codex/analyze-compressed-size-cache branch from 6b27a5a to 74e9659 Compare October 21, 2026 00:07
@wbinnssmith
wbinnssmith removed this pull request from stack #100487 October 21, 2026 20:51
@wbinnssmith
wbinnssmith added this pull request to stack #100546 October 21, 2026 20:51
@wbinnssmith wbinnssmith changed the title Cache compressed chunk sizes during bundle analysis Cache bundle analysis per output file Oct 21, 2026
Analyze each emitted and traced file once in a cached task that returns
its filename, chunk membership, and chunk parts with normalized sources
and compressed sizes. Routes previously made 3-5 task calls per shared
file, and task-graph bookkeeping for those calls dominated analysis.

Splitting, compression, and membership enumeration become plain helpers
under that task, since each is read once.
@wbinnssmith
wbinnssmith force-pushed the codex/analyze-compressed-size-cache branch from ef570f5 to 33c5747 Compare October 21, 2026 22:00
@wbinnssmith
wbinnssmith merged commit ba182aa into canary Oct 23, 2026
120 checks passed
@wbinnssmith
wbinnssmith deleted the codex/analyze-compressed-size-cache branch October 23, 2026 00:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

created-by: Turbopack team PRs by the Turbopack team. Turbopack Related to Turbopack with Next.js.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants