Skip to content

perf: try fix mf performance regression#12958

Merged
hardfist merged 1 commit intomainfrom
yj/fix-perf
Feb 5, 2026
Merged

perf: try fix mf performance regression#12958
hardfist merged 1 commit intomainfrom
yj/fix-perf

Conversation

@hardfist
Copy link
Contributor

@hardfist hardfist commented Feb 5, 2026

Summary

partial fix perf regression introduced in #12250
make process_modules parallel which is supported by rayon in previous implemantion

Related links

Checklist

  • Tests updated (or not required).
  • Documentation updated (or not required).

@github-actions github-actions bot added release: performance release: performance related release(mr only) team The issue/pr is created by the member of Rspack. labels Feb 5, 2026
@github-actions
Copy link
Contributor

github-actions bot commented Feb 5, 2026

📝 Benchmark detail: Open

Name Base (2026-02-05 157f887) Current Change
10000_big_production-mode_disable-minimize + exec 14 s ± 323 ms 13.8 s ± 202 ms -1.04 %
10000_development-mode + exec 1.11 s ± 23 ms 1.08 s ± 17 ms -2.82 %
10000_development-mode_hmr + stats 197 ms ± 2 ms 190 ms ± 5.6 ms -3.74 %
10000_development-mode_noop-loader + exec 2.12 s ± 44 ms 2.09 s ± 25 ms -1.21 %
10000_production-mode + exec 1.17 s ± 24 ms 1.16 s ± 19 ms -1.15 %
10000_production-mode_persistent-cold + exec 1.37 s ± 51 ms 1.34 s ± 56 ms -2.05 %
10000_production-mode_persistent-hot + exec 984 ms ± 26 ms 979 ms ± 36 ms -0.57 %
arco-pro_development-mode + exec 1.37 s ± 60 ms 1.34 s ± 68 ms -1.61 %
arco-pro_development-mode_hmr + stats 39 ms ± 1.1 ms 39 ms ± 5.6 ms +0.47 %
arco-pro_production-mode + exec 2.38 s ± 108 ms 2.36 s ± 49 ms -0.85 %
arco-pro_production-mode_generate-package-json-webpack-plugin + exec 2.43 s ± 96 ms 2.39 s ± 91 ms -1.53 %
arco-pro_production-mode_persistent-cold + exec 2.46 s ± 62 ms 2.46 s ± 38 ms +0.35 %
arco-pro_production-mode_persistent-hot + exec 1.37 s ± 19 ms 1.37 s ± 57 ms +0.19 %
arco-pro_production-mode_traverse-chunk-modules + exec 2.4 s ± 92 ms 2.36 s ± 73 ms -1.54 %
large-dyn-imports_development-mode + exec 1.34 s ± 20 ms 1.34 s ± 30 ms -0.10 %
large-dyn-imports_production-mode + exec 1.45 s ± 50 ms 1.42 s ± 32 ms -2.62 %
threejs_development-mode_10x + exec 1.21 s ± 12 ms 1.18 s ± 20 ms -2.44 %
threejs_development-mode_10x_hmr + stats 125 ms ± 4.8 ms 121 ms ± 4 ms -3.29 %
threejs_production-mode_10x + exec 3.3 s ± 32 ms 3.27 s ± 40 ms -0.95 %
threejs_production-mode_10x_persistent-cold + exec 3.41 s ± 16 ms 3.39 s ± 36 ms -0.49 %
threejs_production-mode_10x_persistent-hot + exec 2.82 s ± 44 ms 2.79 s ± 21 ms -1.11 %
10000_big_production-mode_disable-minimize + rss memory 2247 MiB ± 21.1 MiB 2273 MiB ± 98.6 MiB +1.18 %
10000_development-mode + rss memory 667 MiB ± 21.8 MiB 653 MiB ± 26.4 MiB -2.04 %
10000_development-mode_hmr + rss memory 847 MiB ± 18 MiB 842 MiB ± 26.3 MiB -0.65 %
10000_development-mode_noop-loader + rss memory 975 MiB ± 29.2 MiB 949 MiB ± 17.2 MiB -2.66 %
10000_production-mode + rss memory 572 MiB ± 22.4 MiB 558 MiB ± 26.6 MiB -2.51 %
10000_production-mode_persistent-cold + rss memory 800 MiB ± 31.2 MiB 779 MiB ± 16.3 MiB -2.70 %
10000_production-mode_persistent-hot + rss memory 758 MiB ± 18.6 MiB 748 MiB ± 14.1 MiB -1.32 %
arco-pro_development-mode + rss memory 554 MiB ± 32.8 MiB 551 MiB ± 15.5 MiB -0.45 %
arco-pro_development-mode_hmr + rss memory 476 MiB ± 21.4 MiB 473 MiB ± 34.2 MiB -0.49 %
arco-pro_production-mode + rss memory 600 MiB ± 59.7 MiB 623 MiB ± 61.6 MiB +3.75 %
arco-pro_production-mode_generate-package-json-webpack-plugin + rss memory 614 MiB ± 64.6 MiB 623 MiB ± 51 MiB +1.49 %
arco-pro_production-mode_persistent-cold + rss memory 692 MiB ± 48.4 MiB 689 MiB ± 42 MiB -0.43 %
arco-pro_production-mode_persistent-hot + rss memory 440 MiB ± 69.1 MiB 439 MiB ± 73.3 MiB -0.27 %
arco-pro_production-mode_traverse-chunk-modules + rss memory 603 MiB ± 30.3 MiB 597 MiB ± 38.9 MiB -1.00 %
large-dyn-imports_development-mode + rss memory 684 MiB ± 17.8 MiB 683 MiB ± 13 MiB -0.09 %
large-dyn-imports_production-mode + rss memory 508 MiB ± 10.6 MiB 501 MiB ± 4.73 MiB -1.26 %
threejs_development-mode_10x + rss memory 546 MiB ± 21.5 MiB 533 MiB ± 23.3 MiB -2.38 %
threejs_development-mode_10x_hmr + rss memory 771 MiB ± 18.2 MiB 774 MiB ± 18.9 MiB +0.41 %
threejs_production-mode_10x + rss memory 679 MiB ± 10.8 MiB 684 MiB ± 9.67 MiB +0.71 %
threejs_production-mode_10x_persistent-cold + rss memory 824 MiB ± 13.7 MiB 811 MiB ± 17.2 MiB -1.50 %
threejs_production-mode_10x_persistent-hot + rss memory 661 MiB ± 25.3 MiB 645 MiB ± 23.7 MiB -2.41 %

@github-actions
Copy link
Contributor

github-actions bot commented Feb 5, 2026

Rsdoctor Bundle Diff Analysis

Found 5 projects in monorepo, 0 projects with changes.

📊 Quick Summary
Project Total Size Change
react-10k 5.7 MB 0
react-1k 825.4 KB 0
react-5k 2.7 MB 0
ui-components 2.2 MB 0
rome 984.2 KB 0

Generated by Rsdoctor GitHub Action

@github-actions
Copy link
Contributor

github-actions bot commented Feb 5, 2026

📦 Binary Size-limit

Comparing 1c92e07 to refactor: move build_chunk_graph result to build_chunk_graph_artifact (#12917) by hardfist

❌ Size increased by 8.25KB from 48.55MB to 48.56MB (⬆️0.02%)

@codspeed-hq
Copy link

codspeed-hq bot commented Feb 5, 2026

CodSpeed Performance Report

Merging this PR will not alter performance

Comparing yj/fix-perf (1c92e07) with main (d440f8a)

Summary

✅ 16 untouched benchmarks
⏩ 1 skipped benchmark1

Footnotes

  1. 1 benchmark was skipped, so the baseline result was used instead. If it was deleted from the codebase, click here and archive it to remove it from the performance reports.

@hardfist hardfist marked this pull request as ready for review February 5, 2026 14:55
Copilot AI review requested due to automatic review settings February 5, 2026 14:55
@hardfist hardfist merged commit 5b579bb into main Feb 5, 2026
56 of 59 checks passed
@hardfist hardfist deleted the yj/fix-perf branch February 5, 2026 14:59
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR aims to fix a module federation performance regression by parallelizing the batch processing of modules in the FlagDependencyUsagePlugin.

Changes:

  • Replaced sequential batch processing with concurrent execution using rspack_futures::scope
  • Refactored process_module from an instance method to a static method to enable parallel execution
  • Added unsafe code block for concurrent task spawning with proper safety comments

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

})
.await
.into_iter()
.map(|res| res.expect("flag dependency usage task failed"))
Copy link

Copilot AI Feb 5, 2026

Choose a reason for hiding this comment

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

Using .expect() will cause a panic if any task fails, which will crash the entire compilation process. Consider handling errors more gracefully, such as collecting errors and reporting them as diagnostics instead of panicking. This would provide better error messages and allow the compilation to continue or fail more gracefully.

Suggested change
.map(|res| res.expect("flag dependency usage task failed"))
.filter_map(|res| match res {
Ok(value) => Some(value),
Err(err) => {
eprintln!("flag dependency usage task failed: {:?}", err);
None
}
})

Copilot uses AI. Check for mistakes.
Comment on lines +326 to 337
compilation
.plugin_driver
.compilation_hooks
.dependency_referenced_exports
.call(
self.compilation,
compilation,
&dep_id,
&referenced_exports_result,
runtime,
Some(self.build_module_graph_artifact.get_module_graph()),
Some(module_graph),
)
.await;
Copy link

Copilot AI Feb 5, 2026

Choose a reason for hiding this comment

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

Potential race condition: The dependency_referenced_exports hook is being called concurrently from multiple parallel tasks. While the hook itself is defined as Series (sequential execution), multiple tasks spawned by rspack_futures::scope are calling this hook simultaneously. This could lead to race conditions if the hook has any internal state or if it performs operations that aren't thread-safe. Consider whether this hook needs to be called sequentially across all tasks, or if it's safe to be called concurrently.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release: performance release: performance related release(mr only) team The issue/pr is created by the member of Rspack.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants