Skip to content

perf: Optimize ModuleGraph API implementation#13010

Open
hardfist wants to merge 1 commit intomainfrom
codex/modulegraph
Open

perf: Optimize ModuleGraph API implementation#13010
hardfist wants to merge 1 commit intomainfrom
codex/modulegraph

Conversation

@hardfist
Copy link
Contributor

@hardfist hardfist commented Feb 9, 2026

Summary

  • Refine the ModuleGraph API with performance-focused improvements to better support downstream work on the codex/modulegraph branch.
  • Keep behavior consistent while targeting efficiency gains in the module graph operations.

Testing

  • Not run (not requested)

Copilot AI review requested due to automatic review settings February 9, 2026 13:54
@github-actions github-actions bot added the team The issue/pr is created by the member of Rspack. label Feb 9, 2026
@hardfist hardfist changed the title Optimize ModuleGraph API implementation perf: Optimize ModuleGraph API implementation Feb 9, 2026
@github-actions github-actions bot added the release: performance release: performance related release(mr only) label Feb 9, 2026
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

Refines ModuleGraph batch update APIs to avoid parallel cloning/reinsertion and instead mutate connections/modules in-place, aiming to reduce overhead in module graph operations.

Changes:

  • Remove Rayon-based parallel mapping in several ModuleGraph batch update methods.
  • Update connections and module graph modules in-place via *_mut accessors to avoid cloning and re-inserting.

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

Comment on lines +976 to +980
for (dep_id, original_module_identifier) in tasks {
let con = self
.connection_by_dependency_id_mut(&dep_id)
.expect("should have connection");
con.original_module_identifier = Some(original_module_identifier);
Copy link

Copilot AI Feb 9, 2026

Choose a reason for hiding this comment

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

expect("should have connection") will panic without identifying which DependencyId was missing, making debugging difficult. Consider using unwrap_or_else/expect with a message that includes dep_id so failures in batch updates are actionable.

Copilot uses AI. Check for mistakes.
Comment on lines +985 to +989
for (dep_id, module_identifier) in tasks {
let con = self
.connection_by_dependency_id_mut(&dep_id)
.expect("should have connection");
con.set_module_identifier(module_identifier);
Copy link

Copilot AI Feb 9, 2026

Choose a reason for hiding this comment

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

Same as above: this expect("should have connection") panic message lacks the DependencyId context. Including dep_id in the panic/expect message would make failures easier to diagnose (similar to do_update_module nearby).

Copilot uses AI. Check for mistakes.
@github-actions
Copy link
Contributor

github-actions bot commented Feb 9, 2026

📦 Binary Size-limit

Comparing 0807a01 to refactor: wrap artifact in StealCell (#12979) by hardfist

🎉 Size decreased by 48.00KB from 48.65MB to 48.61MB (⬇️0.10%)

@github-actions
Copy link
Contributor

github-actions bot commented Feb 9, 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
rome 984.2 KB 0
ui-components 2.2 MB 0

Generated by Rsdoctor GitHub Action

@codspeed-hq
Copy link

codspeed-hq bot commented Feb 9, 2026

CodSpeed Performance Report

Merging this PR will not alter performance

Comparing codex/modulegraph (0807a01) with main (9f4fc6e)

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.

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.

1 participant