Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6975c87f6f
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if is_normal_module { | ||
| tasks.extend(take_normal_module_dedupe_tasks(context, module_identifier)); |
There was a problem hiding this comment.
Release dedupe waiters when module ceases to be NormalModule
This only wakes dedupe waiters when the added module is still a NormalModule, but the claim is taken earlier in normal_module_factory before normal_module_factory_hooks.module can replace it. Hooks such as DelegatedPlugin::nmf_module can swap module to DelegatedModule, so the owner task never calls mark_ready and all deduped requests remain stuck behind PendingNormalModuleDedupeTask, leaving those dependencies unresolved in the module graph.
Useful? React with 👍 / 👎.
| .normal_module_dedupe_tracker | ||
| .take_waiters_and_clear(module_identifier) |
There was a problem hiding this comment.
Avoid clearing dedupe state before waiters can register
On a factorization failure for a claimed normal-module id, this clears the tracker entry in the background task, but waiters are only registered later in FactorizeResultTask::main_run. If a deduped sibling finishes after this clear, register_waiter_or_get_ready sees a vacant entry and treats it as ready, causing ReuseNormalModuleTask to resolve dependencies to a module identifier that was never added.
Useful? React with 👍 / 👎.
|
📝 Benchmark detail: Open No benchmark data for commit 93af830, trying parent...
|
There was a problem hiding this comment.
Pull request overview
This PR introduces a NormalModule deduplication mechanism during module graph repair/factorization to avoid creating/factorizing the same NormalModule multiple times and instead reuse an existing/in-progress module by identifier.
Changes:
- Extend
ModuleFactoryResult/ModuleFactoryCreateDatato support “deduped normal module” signaling and tracking. - Add
NormalModuleDedupeTrackerand wire it through the repair task pipeline to coordinate reuse. - Update
NormalModuleFactoryto claim identifiers and return a dedupe result when an identical NormalModule is already claimed.
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| crates/rspack_plugin_dll/src/dll_entry/dll_module_factory.rs | Populate the new normal_module_dedup field in factory result. |
| crates/rspack_core/src/normal_module_factory.rs | Claim NormalModule identifiers and return dedupe-only factory results when already claimed. |
| crates/rspack_core/src/normal_module.rs | Expose create_id as pub(crate) for identifier computation. |
| crates/rspack_core/src/module_factory.rs | Add dedupe tracker + waiter types; extend factory input/output structs to carry dedupe info. |
| crates/rspack_core/src/context_module_factory.rs | Populate the new normal_module_dedup field in factory result. |
| crates/rspack_core/src/compilation/build_module_graph/module_executor/entry.rs | Thread the dedupe tracker into executor-created factorize tasks. |
| crates/rspack_core/src/compilation/build_module_graph/graph_updater/repair/process_dependencies.rs | Thread the dedupe tracker into factorize tasks spawned from dependency processing. |
| crates/rspack_core/src/compilation/build_module_graph/graph_updater/repair/mod.rs | Initialize and propagate the shared dedupe tracker for repair runs. |
| crates/rspack_core/src/compilation/build_module_graph/graph_updater/repair/context.rs | Add dedupe tracker storage to TaskContext. |
| crates/rspack_core/src/compilation/build_module_graph/graph_updater/repair/factorize.rs | Handle dedupe-only factory results by queueing waiters and reusing existing modules. |
| crates/rspack_core/src/compilation/build_module_graph/graph_updater/repair/add.rs | Mark dedupe entries ready when a NormalModule is added and schedule reuse tasks for waiters. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| ready: true, | ||
| waiters: vec![], | ||
| }); | ||
| Some(waiter) |
| if factorize_failed | ||
| && let Some(module_identifier) = claimed_normal_module_identifier | ||
| && let Some(waiter_failure_info) = waiter_failure_info.as_ref() | ||
| { | ||
| for waiter in create_data | ||
| .normal_module_dedupe_tracker | ||
| .take_waiters_and_clear(module_identifier) | ||
| { | ||
| let factorize_info = clone_factorize_failure_info(waiter_failure_info, &waiter); | ||
| tasks.push(Box::new(FactorizeResultTask { | ||
| original_module_identifier: waiter.original_module_identifier, | ||
| factory_result: None, | ||
| normal_module_dedup: None, | ||
| dependencies: waiter.dependencies, | ||
| factorize_info, | ||
| from_unlazy: waiter.from_unlazy, | ||
| })); | ||
| } | ||
| } |
| pub normal_module_dedup: Option<ModuleIdentifier>, | ||
| } | ||
|
|
||
| impl ModuleFactoryResult { | ||
| pub fn new_with_module(module: BoxModule) -> Self { | ||
| Self { | ||
| module: Some(module), | ||
| normal_module_dedup: None, | ||
| } | ||
| } | ||
|
|
||
| pub fn new_with_normal_module_dedup(module_identifier: ModuleIdentifier) -> Self { | ||
| Self { | ||
| module: None, | ||
| normal_module_dedup: Some(module_identifier), |
Rsdoctor Bundle Diff Analysis
Found 5 projects in monorepo, 0 projects with changes. 📊 Quick Summary
Generated by Rsdoctor GitHub Action |
📦 Binary Size-limit
❌ Size increased by 20.88KB from 49.04MB to 49.06MB (⬆️0.04%) |
Merging this PR will not alter performance
Comparing Footnotes
|
|
📝 Benchmark detail: Open
|
No description provided.