Skip to content

Turbopack: reduce hmr chunk list subscriptions#94062

Merged
wbinnssmith merged 4 commits into
wbinnssmith/add-chunk-name-get-hmr-subscriptionfrom
wbinnssmith/hmr-flatten-chunklist
May 29, 2026
Merged

Turbopack: reduce hmr chunk list subscriptions#94062
wbinnssmith merged 4 commits into
wbinnssmith/add-chunk-name-get-hmr-subscriptionfrom
wbinnssmith/hmr-flatten-chunklist

Conversation

@wbinnssmith
Copy link
Copy Markdown
Member

@wbinnssmith wbinnssmith commented May 23, 2026

Previously, we created chunk list register chunks for every reachable chunk in the chunk graph on a page. Now, we only create one that subscribes to all recursively reachable assets.

This has to pass around an explicit list of client references chunks as those cannot be discovered via the chunk graph alone.

This results in a significant performance improvement when loading pages with the dev server, improving performance of a 60s cold build in a large app by about 10s.

Comment thread packages/next-routing/tsconfig.json
@wbinnssmith wbinnssmith requested review from lukesandberg and sokra May 23, 2026 00:08
@wbinnssmith wbinnssmith marked this pull request as ready for review May 23, 2026 00:08
Copy link
Copy Markdown
Contributor

@vercel vercel Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Additional Suggestion:

Missing extra_chunks parameter in evaluated_chunk_group_assets call causes compilation error in snapshot tests.

Fix on Vercel

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 23, 2026

Tests Passed

Commit: a483b67

Comment thread turbopack/crates/turbopack-browser/src/chunking_context.rs Outdated
Comment thread crates/next-core/src/next_app/app_client_references_chunks.rs Outdated
Comment thread crates/next-core/src/next_app/app_client_shared_chunks.rs Outdated
@wbinnssmith wbinnssmith force-pushed the wbinnssmith/hmr-flatten-chunklist branch from 9560751 to c79c2d6 Compare May 26, 2026 17:01
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 26, 2026

Stats skipped

Commit: a483b67
View workflow run

@wbinnssmith wbinnssmith force-pushed the wbinnssmith/hmr-flatten-chunklist branch from c79c2d6 to 21af9e8 Compare May 26, 2026 18:31
@wbinnssmith wbinnssmith force-pushed the wbinnssmith/add-chunk-name-get-hmr-subscription branch from 99aeb0d to 6b4c7e5 Compare May 26, 2026 18:31
@wbinnssmith wbinnssmith force-pushed the wbinnssmith/hmr-flatten-chunklist branch from 21af9e8 to 2d4b4f3 Compare May 26, 2026 20:04
@wbinnssmith wbinnssmith force-pushed the wbinnssmith/add-chunk-name-get-hmr-subscription branch from 6b4c7e5 to 7cad598 Compare May 26, 2026 20:07
@wbinnssmith wbinnssmith force-pushed the wbinnssmith/hmr-flatten-chunklist branch 2 times, most recently from 63afe13 to cdc75f1 Compare May 26, 2026 20:22
@wbinnssmith wbinnssmith marked this pull request as draft May 26, 2026 22:36
@wbinnssmith wbinnssmith force-pushed the wbinnssmith/add-chunk-name-get-hmr-subscription branch from 7cad598 to 554bdfa Compare May 27, 2026 19:04
Comment thread packages/next/src/server/dev/hot-reloader-turbopack.ts
Comment thread test/development/app-dir/hmr-dynamic-component/chunk-list-subscriptions.test.ts Outdated
Comment thread test/development/app-dir/hmr-dynamic-component/next.config.js
@wbinnssmith wbinnssmith force-pushed the wbinnssmith/hmr-flatten-chunklist branch from 409cf9c to 0caa23a Compare May 27, 2026 21:05
@wbinnssmith wbinnssmith force-pushed the wbinnssmith/add-chunk-name-get-hmr-subscription branch 2 times, most recently from d6241a6 to 019b601 Compare May 27, 2026 21:32
@wbinnssmith wbinnssmith force-pushed the wbinnssmith/hmr-flatten-chunklist branch 3 times, most recently from 6b4d5ac to c4b26d1 Compare May 28, 2026 00:39
@wbinnssmith wbinnssmith force-pushed the wbinnssmith/add-chunk-name-get-hmr-subscription branch from 019b601 to b9c71c2 Compare May 28, 2026 02:29
@wbinnssmith wbinnssmith force-pushed the wbinnssmith/hmr-flatten-chunklist branch from 6b4d5ac to b46ae83 Compare May 28, 2026 02:29
Comment thread crates/next-api/src/app.rs Outdated
Comment thread crates/next-api/src/app.rs Outdated
Comment thread crates/next-api/src/app.rs Outdated
Comment thread crates/next-api/src/app.rs Outdated
Comment thread crates/next-api/src/app.rs
@wbinnssmith wbinnssmith force-pushed the wbinnssmith/hmr-flatten-chunklist branch 2 times, most recently from b9c7ab7 to 75760c2 Compare May 28, 2026 17:38
@wbinnssmith wbinnssmith force-pushed the wbinnssmith/add-chunk-name-get-hmr-subscription branch from b9c71c2 to 92ab975 Compare May 28, 2026 17:38
@wbinnssmith wbinnssmith force-pushed the wbinnssmith/hmr-flatten-chunklist branch from 75760c2 to 1f37615 Compare May 28, 2026 17:38
@wbinnssmith wbinnssmith force-pushed the wbinnssmith/add-chunk-name-get-hmr-subscription branch from 92ab975 to 09e120d Compare May 28, 2026 18:49
@wbinnssmith wbinnssmith force-pushed the wbinnssmith/hmr-flatten-chunklist branch 2 times, most recently from c4c12c5 to 4768053 Compare May 28, 2026 19:40
@wbinnssmith wbinnssmith marked this pull request as ready for review May 28, 2026 20:24
@wbinnssmith wbinnssmith requested review from lukesandberg and sokra May 28, 2026 20:27
Comment thread crates/next-core/src/next_app/app_client_references_chunks.rs Outdated
Comment thread turbopack/crates/turbopack-browser/src/chunking_context.rs Outdated
@wbinnssmith wbinnssmith force-pushed the wbinnssmith/hmr-flatten-chunklist branch from 4768053 to 7f87209 Compare May 29, 2026 17:17
@wbinnssmith wbinnssmith force-pushed the wbinnssmith/add-chunk-name-get-hmr-subscription branch from 09e120d to 225c7ab Compare May 29, 2026 17:17
This adds the chunk's file path to the span as metadata.
…references

Each chunk_group call for RSC client references previously generated a Dynamic
EcmascriptDevChunkList, creating one subscription per client component group.

Remove the Dynamic chunk list from chunk_group and pass client reference chunks
as extra_chunks to evaluated_chunk_group, merging them into the single Entry
chunk list the browser already subscribes to.
@wbinnssmith wbinnssmith force-pushed the wbinnssmith/hmr-flatten-chunklist branch from 7f87209 to a483b67 Compare May 29, 2026 18:16
@wbinnssmith wbinnssmith force-pushed the wbinnssmith/add-chunk-name-get-hmr-subscription branch from 225c7ab to d14ac12 Compare May 29, 2026 18:16
@wbinnssmith wbinnssmith merged commit 8216e23 into canary May 29, 2026
336 of 353 checks passed
@wbinnssmith wbinnssmith deleted the wbinnssmith/hmr-flatten-chunklist branch May 29, 2026 19:12
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.

3 participants