Skip to content

Commit 2ec1cf5

Browse files
authored
fix(incremental): get affected modules with chunk graph perf regression (#8592)
1 parent 0de6669 commit 2ec1cf5

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

crates/rspack_core/src/incremental/mutations.rs

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ use std::{
66
use once_cell::sync::OnceCell;
77
use rayon::iter::{IntoParallelRefIterator, ParallelIterator};
88
use rspack_collections::{IdentifierDashMap, IdentifierMap, IdentifierSet, UkeySet};
9-
use rspack_util::fx_hash::FxIndexSet;
109
use rustc_hash::FxHasher;
1110

1211
use crate::{
@@ -300,22 +299,24 @@ fn compute_affected_modules_with_chunk_graph(
300299
) -> u64 {
301300
let module_identifier = module.identifier();
302301
let mut hasher = FxHasher::default();
303-
chunk_graph
302+
compilation
303+
.chunk_graph
304304
.get_module_id(module_identifier)
305305
.hash(&mut hasher);
306306
ModuleGraph::is_async(compilation, &module_identifier).hash(&mut hasher);
307-
let module_ids: FxIndexSet<_> = module_graph
307+
for module_id in module_graph
308308
.get_ordered_connections(&module_identifier)
309309
.expect("should have module")
310310
.into_iter()
311311
.filter_map(|dep_id| {
312312
let connection = module_graph
313313
.connection_by_dependency_id(dep_id)
314314
.expect("should have connection");
315-
chunk_graph.get_module_id(*connection.module_identifier())
315+
compilation
316+
.chunk_graph
317+
.get_module_id(*connection.module_identifier())
316318
})
317-
.collect();
318-
for module_id in module_ids {
319+
{
319320
module_id.hash(&mut hasher);
320321
}
321322
for block_id in module.get_blocks() {
@@ -341,7 +342,7 @@ fn compute_affected_modules_with_chunk_graph(
341342

342343
let module_graph = compilation.get_module_graph();
343344
let affected_modules: IdentifierMap<u64> = cache
344-
.iter()
345+
.par_iter()
345346
.filter_map(|item| {
346347
let (module_identifier, &old_invalidate_key) = item.pair();
347348
let module = module_graph

0 commit comments

Comments
 (0)