Skip to content

Commit 9aa45b5

Browse files
authored
fix: align logger timing with webpack (#13721)
1 parent b0f20e5 commit 9aa45b5

8 files changed

Lines changed: 9 additions & 22 deletions

File tree

crates/rspack_core/src/compilation/build_module_graph/mod.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,10 @@ pub use self::{
1717
module_executor::{ExecuteModuleId, ExecutedRuntimeModule, ModuleExecutor},
1818
};
1919
pub use crate::BuildModuleGraphArtifact;
20-
use crate::{Compilation, ExportsInfoArtifact, logger::Logger};
20+
use crate::{Compilation, ExportsInfoArtifact};
2121

2222
pub async fn build_module_graph_pass(compilation: &mut Compilation) -> Result<()> {
23-
let logger = compilation.get_logger("rspack.Compiler");
24-
let start = logger.time("build module graph");
2523
do_build_module_graph(compilation).await?;
26-
logger.time_end(start);
2724
Ok(())
2825
}
2926

crates/rspack_core/src/compilation/build_module_graph/pass.rs

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ use crate::{
99
finish_make::finish_make_pass, finish_module_graph::finish_module_graph_pass,
1010
make::make_hook_pass, pass::PassExt,
1111
},
12+
logger::Logger,
1213
};
1314

1415
/// Composite pass for the entire Build Module Graph phase.
@@ -41,20 +42,16 @@ impl PassExt for BuildModuleGraphPhasePass {
4142
_cache: &mut dyn Cache,
4243
) -> Result<()> {
4344
let plugin_driver = compilation.plugin_driver.clone();
44-
45-
// Sub-phase: make hook
45+
let logger = compilation.get_logger("rspack.Compiler");
46+
// align with webpack, make hook include build_module_graph phase in webpack
47+
let start = logger.time("make hook");
4648
make_hook_pass(compilation, plugin_driver.clone()).await?;
47-
48-
// Sub-phase: build module graph
4949
build_module_graph_pass(compilation).await?;
50+
logger.time_end(start);
5051

51-
// Sub-phase: finish make
52-
finish_make_pass(compilation, plugin_driver.clone()).await?;
53-
54-
// Sub-phase: finish module graph
52+
finish_make_pass(compilation, plugin_driver).await?;
5553
finish_module_graph_pass(compilation).await?;
5654

57-
// Add checkpoint if incremental build is enabled
5855
use crate::incremental::IncrementalPasses;
5956
if compilation
6057
.incremental

crates/rspack_core/src/compilation/finish_module_graph/mod.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ pub async fn finish_module_graph_pass(compilation: &mut Compilation) -> Result<(
1212
let logger = compilation.get_logger("rspack.Compiler");
1313
let start = logger.time("finish compilation");
1414
finish_build_module_graph_pass(compilation).await?;
15-
1615
logger.time_end(start);
1716

1817
Ok(())
Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,12 @@
11
use rspack_error::Result;
22

3-
use crate::{Compilation, SharedPluginDriver, logger::Logger};
3+
use crate::{Compilation, SharedPluginDriver};
44

55
pub async fn make_hook_pass(
66
compilation: &mut Compilation,
77
plugin_driver: SharedPluginDriver,
88
) -> Result<()> {
9-
let logger = compilation.get_logger("rspack.Compiler");
10-
11-
let start = logger.time("make hook");
129
plugin_driver.compiler_hooks.make.call(compilation).await?;
13-
logger.time_end(start);
1410

1511
Ok(())
1612
}

crates/rspack_core/src/compilation/run_passes.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ impl Compilation {
5050
for pass in &passes {
5151
pass.run(self, cache).await?;
5252
}
53+
5354
if !self.options.mode.is_development() {
5455
self.module_static_cache.disable_cache();
5556
}

tests/rspack-test/statsAPICases/verbose-time.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ module.exports = {
4545
4646
LOG from rspack.Compiler
4747
<t> make hook: X ms
48-
<t> build module graph: X ms
4948
<t> finish make hook: X ms
5049
<t> finish compilation: X ms
5150
<t> seal compilation: X ms

tests/rspack-test/statsOutputCases/logging/__snapshots__/stats.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,6 @@ LOG from rspack.Compilation
8383

8484
LOG from rspack.Compiler
8585
<t> make hook: xx ms
86-
<t> build module graph: xx ms
8786
<t> finish make hook: xx ms
8887
<t> finish compilation: xx ms
8988
<t> seal compilation: xx ms

tests/rspack-test/statsOutputCases/preset-verbose/__snapshots__/stats.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,6 @@ LOG from rspack.Compilation
7272

7373
LOG from rspack.Compiler
7474
<t> make hook: xx ms
75-
<t> build module graph: xx ms
7675
<t> finish make hook: xx ms
7776
<t> finish compilation: xx ms
7877
<t> seal compilation: xx ms

0 commit comments

Comments
 (0)