Skip to content
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

fix(incremental): get affected modules with chunk graph perf regression #8592

Merged
merged 1 commit into from
Dec 2, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 8 additions & 7 deletions crates/rspack_core/src/incremental/mutations.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ use std::{
use once_cell::sync::OnceCell;
use rayon::iter::{IntoParallelRefIterator, ParallelIterator};
use rspack_collections::{IdentifierDashMap, IdentifierMap, IdentifierSet, UkeySet};
use rspack_util::fx_hash::FxIndexSet;
use rustc_hash::FxHasher;

use crate::{
Expand Down Expand Up @@ -300,22 +299,24 @@ fn compute_affected_modules_with_chunk_graph(
) -> u64 {
let module_identifier = module.identifier();
let mut hasher = FxHasher::default();
chunk_graph
compilation
.chunk_graph
.get_module_id(module_identifier)
.hash(&mut hasher);
ModuleGraph::is_async(compilation, &module_identifier).hash(&mut hasher);
let module_ids: FxIndexSet<_> = module_graph
for module_id in module_graph
.get_ordered_connections(&module_identifier)
.expect("should have module")
.into_iter()
.filter_map(|dep_id| {
let connection = module_graph
.connection_by_dependency_id(dep_id)
.expect("should have connection");
chunk_graph.get_module_id(*connection.module_identifier())
compilation
.chunk_graph
.get_module_id(*connection.module_identifier())
})
.collect();
for module_id in module_ids {
{
module_id.hash(&mut hasher);
}
for block_id in module.get_blocks() {
Expand All @@ -341,7 +342,7 @@ fn compute_affected_modules_with_chunk_graph(

let module_graph = compilation.get_module_graph();
let affected_modules: IdentifierMap<u64> = cache
.iter()
.par_iter()
.filter_map(|item| {
let (module_identifier, &old_invalidate_key) = item.pair();
let module = module_graph
Expand Down
Loading