-
Notifications
You must be signed in to change notification settings - Fork 30.3k
Turbopack: snapshot the ModuleGraph to avoid (eventual) inconsistent graphs #88340
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: sokra/parallel-backend
Are you sure you want to change the base?
Conversation
|
Allow CI Workflow Run
Note: this should only be enabled once the PR is ready to go and can only be enabled by a maintainer |
9b8b94f to
e70e940
Compare
52d9dd0 to
965d41d
Compare
| let binding_usage_info = remove_unused_imports.then(|| { | ||
| compute_binding_usage_info( | ||
| ModuleGraph::from_graphs(graphs.clone()), | ||
| should_read_binding_usage, | ||
| ) | ||
| }); | ||
|
|
||
| let full = if let Some(binding_usage_info) = binding_usage_info { | ||
| ModuleGraph::from_graphs_without_unused_references(graphs, binding_usage_info) | ||
| } else { | ||
| full_with_unused_references | ||
| ModuleGraph::from_graphs(graphs) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| let binding_usage_info = remove_unused_imports.then(|| { | |
| compute_binding_usage_info( | |
| ModuleGraph::from_graphs(graphs.clone()), | |
| should_read_binding_usage, | |
| ) | |
| }); | |
| let full = if let Some(binding_usage_info) = binding_usage_info { | |
| ModuleGraph::from_graphs_without_unused_references(graphs, binding_usage_info) | |
| } else { | |
| full_with_unused_references | |
| ModuleGraph::from_graphs(graphs) | |
| let (full, binding_usage_info) = if remove_unused_imports { | |
| let full_with_unused_references = ModuleGraph::from_graphs(graphs.clone()); | |
| let binding_usage_info = compute_binding_usage_info( | |
| full_with_unused_references, | |
| should_read_binding_usage, | |
| ); | |
| ( | |
| ModuleGraph::from_graphs_without_unused_references(graphs, binding_usage_info), | |
| Some(binding_usage_info), | |
| ) | |
| } else { | |
| (ModuleGraph::from_graphs(graphs), None) |
Type mismatch in binding_usage_info assignment - closure returns Future instead of OperationVc
CodSpeed Performance ReportMerging this PR will improve performance by 3.6%Comparing Summary
Performance Changes
Footnotes
|
Failing test suitesCommit: 965d41d | About building and testing Next.js
Expand output● Errors on invalid custom routes › development mode › should error during next build for invalid headers |
Stats from current PR✅ No significant changes detected📊 All Metrics📖 Metrics GlossaryDev Server Metrics:
Build Metrics:
Change Thresholds:
⚡ Dev Server
📦 Dev Server (Webpack) (Legacy)📦 Dev Server (Webpack)
⚡ Production Builds
📦 Production Builds (Webpack) (Legacy)📦 Production Builds (Webpack)
📦 Bundle SizesBundle Sizes⚡ TurbopackClient Main Bundles: **430 kB** → **430 kB** ✅ -29 B82 files with content-based hashes (individual files not comparable between builds) Server Middleware
Build DetailsBuild Manifests
📦 WebpackClient Main Bundles
Polyfills
Pages
Server Edge SSR
Middleware
Build DetailsBuild Manifests
Build Cache
🔄 Shared (bundler-independent)Runtimes
|
| impl ClientReferencesGraph { | ||
| #[turbo_tasks::function] | ||
| pub async fn new_with_entries( | ||
| graph: SingleModuleGraphWithBindingUsage, | ||
| graph: ResolvedVc<ModuleGraph>, | ||
| is_single_page: bool, | ||
| ) -> Result<Vc<Self>> { | ||
| let mapped = map_client_references(*graph.graph); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Previously, the types ensured/made it obvious that this should be one of the individual stacked graphs.
But not anymore, even though it's still the individual graph, as far as I can tell?

What?
Refactor ModuleGraph to be a strongly consistent snapshot of the module graph. This should avoid eventually consistency problems where different versions of single module graphs do not fit together.