Skip to content

Commit

Permalink
fix: use intersection runtime for concat module code gen (#7523)
Browse files Browse the repository at this point in the history
  • Loading branch information
ahabhgk authored Aug 12, 2024
1 parent a7844d9 commit cf41f17
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions crates/rspack_core/src/concatenated_module.rs
Original file line number Diff line number Diff line change
Expand Up @@ -614,19 +614,23 @@ impl Module for ConcatenatedModule {
fn code_generation(
&self,
compilation: &Compilation,
runtime: Option<&RuntimeSpec>,
generation_runtime: Option<&RuntimeSpec>,
_: Option<ConcatenationScope>,
) -> Result<CodeGenerationResult> {
let mut runtime_requirements = RuntimeGlobals::default();
let generation_runtime = runtime.cloned().expect("should have runtime");
let merged_runtime = if let Some(ref runtime) = self.runtime {
generation_runtime
.intersection(runtime)
.cloned()
.collect::<RuntimeSpec>()
let runtime = if let Some(self_runtime) = &self.runtime
&& let Some(generation_runtime) = generation_runtime
{
Some(Cow::Owned(
generation_runtime
.intersection(self_runtime)
.cloned()
.collect::<RuntimeSpec>(),
))
} else {
generation_runtime
generation_runtime.map(Cow::Borrowed)
};
let runtime = runtime.as_deref();
let context = compilation.options.context.clone();

let (modules_with_info, module_to_info_map) =
Expand All @@ -642,12 +646,8 @@ impl Module for ConcatenatedModule {
let tmp: Vec<rspack_error::Result<(rspack_collections::Identifier, ModuleInfo)>> = arc_map
.par_iter()
.map(|(id, info)| {
let updated_module_info = self.analyze_module(
compilation,
Arc::clone(&arc_map),
info.clone(),
Some(&merged_runtime),
)?;
let updated_module_info =
self.analyze_module(compilation, Arc::clone(&arc_map), info.clone(), runtime)?;
Ok((*id, updated_module_info))
})
.collect::<Vec<_>>();
Expand Down

2 comments on commit cf41f17

@rspack-bot
Copy link

Choose a reason for hiding this comment

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

📝 Ran ecosystem CI: Open

suite result
modernjs ❌ failure
_selftest ✅ success
nx ❌ failure
rspress ✅ success
rsbuild ✅ success
examples ✅ success

@rspack-bot
Copy link

Choose a reason for hiding this comment

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

📝 Benchmark detail: Open

Name Base (2024-08-12 a7844d9) Current Change
10000_development-mode + exec 2.31 s ± 26 ms 2.31 s ± 31 ms +0.05 %
10000_development-mode_hmr + exec 697 ms ± 10 ms 695 ms ± 9.9 ms -0.25 %
10000_production-mode + exec 2.86 s ± 21 ms 2.86 s ± 29 ms +0.03 %
arco-pro_development-mode + exec 1.86 s ± 57 ms 1.87 s ± 88 ms +0.64 %
arco-pro_development-mode_hmr + exec 433 ms ± 1.1 ms 434 ms ± 1.3 ms +0.08 %
arco-pro_production-mode + exec 3.45 s ± 74 ms 3.46 s ± 130 ms +0.27 %
arco-pro_production-mode_generate-package-json-webpack-plugin + exec 3.54 s ± 88 ms 3.5 s ± 89 ms -1.25 %
threejs_development-mode_10x + exec 1.7 s ± 12 ms 1.69 s ± 23 ms -0.33 %
threejs_development-mode_10x_hmr + exec 821 ms ± 5.6 ms 810 ms ± 7.8 ms -1.25 %
threejs_production-mode_10x + exec 5.48 s ± 32 ms 5.44 s ± 32 ms -0.61 %

Please sign in to comment.