diff --git a/crates/node_binding/binding.d.ts b/crates/node_binding/binding.d.ts index 30d617c498b..bbd77a7ed34 100644 --- a/crates/node_binding/binding.d.ts +++ b/crates/node_binding/binding.d.ts @@ -608,7 +608,6 @@ export interface JsStatsModuleIssuer { export interface JsStatsModuleProfile { factory: JsStatsMillisecond - integration: JsStatsMillisecond building: JsStatsMillisecond } diff --git a/crates/rspack_binding_values/src/stats.rs b/crates/rspack_binding_values/src/stats.rs index 10d92eda210..ac462c4e0c1 100644 --- a/crates/rspack_binding_values/src/stats.rs +++ b/crates/rspack_binding_values/src/stats.rs @@ -346,7 +346,6 @@ impl TryFrom> for JsStatsModule { #[napi(object)] pub struct JsStatsModuleProfile { pub factory: JsStatsMillisecond, - pub integration: JsStatsMillisecond, pub building: JsStatsMillisecond, } @@ -354,7 +353,6 @@ impl From for JsStatsModuleProfile { fn from(value: rspack_core::StatsModuleProfile) -> Self { Self { factory: value.factory.into(), - integration: value.integration.into(), building: value.building.into(), } } diff --git a/crates/rspack_core/src/compiler/make/repair/add.rs b/crates/rspack_core/src/compiler/make/repair/add.rs index 6e8aa317456..c3dc32a8db7 100644 --- a/crates/rspack_core/src/compiler/make/repair/add.rs +++ b/crates/rspack_core/src/compiler/make/repair/add.rs @@ -21,10 +21,6 @@ impl Task for AddTask { TaskType::Sync } fn sync_run(self: Box, context: &mut MakeTaskContext) -> TaskResult { - if let Some(current_profile) = &self.current_profile { - current_profile.mark_integration_start(); - } - let module_identifier = self.module.identifier(); let artifact = &mut context.artifact; let module_graph = @@ -72,10 +68,6 @@ impl Task for AddTask { module_identifier, )?; - if let Some(current_profile) = &self.current_profile { - current_profile.mark_integration_end(); - } - tracing::trace!("Module added: {}", self.module.identifier()); artifact.built_modules.insert(module_identifier); diff --git a/crates/rspack_core/src/module_profile.rs b/crates/rspack_core/src/module_profile.rs index 37d22c9ff19..7fa4fb52c18 100644 --- a/crates/rspack_core/src/module_profile.rs +++ b/crates/rspack_core/src/module_profile.rs @@ -46,17 +46,13 @@ impl ModulePhaseProfile { } } +// https://github.com/webpack/webpack/blob/4809421990a20dfefa06e6445191e65001e75f88/lib/ModuleProfile.js +// NOTE: Rspack has different cache design, remove cache related profiles + #[derive(Debug, Default, Clone)] pub struct ModuleProfile { pub factory: ModulePhaseProfile, - // pub restoring: ModulePhaseProfile, - pub integration: ModulePhaseProfile, pub building: ModulePhaseProfile, - // pub storing: ModulePhaseProfile, - - // pub additional_factory_times: Vec, - // pub additional_factories: Duration, - // pub additional_factories_parallelism_factor: u16, } impl ModuleProfile { @@ -78,43 +74,6 @@ impl ModuleProfile { .expect("should only call once"); } - // TODO: restore module to cache is not implemented yet - // pub fn mark_restoring_start(&self) { - // self - // .restoring - // .range - // .start - // .set(Instant::now()) - // .expect("should only call once"); - // } - - // pub fn mark_restoring_end(&self) { - // self - // .restoring - // .range - // .end - // .set(Instant::now()) - // .expect("should only call once"); - // } - - pub fn mark_integration_start(&self) { - self - .integration - .range - .start - .set(Instant::now()) - .expect("should only call once"); - } - - pub fn mark_integration_end(&self) { - self - .integration - .range - .end - .set(Instant::now()) - .expect("should only call once"); - } - pub fn mark_building_start(&self) { self .building @@ -132,36 +91,4 @@ impl ModuleProfile { .set(Instant::now()) .expect("should only call once"); } - - // TODO: store module to cache is not implemented yet - // pub fn mark_storing_start(&self) { - // self - // .storing - // .range - // .start - // .set(Instant::now()) - // .expect("should only call once"); - // } - - // pub fn mark_storing_end(&self) { - // self - // .storing - // .range - // .end - // .set(Instant::now()) - // .expect("should only call once"); - // } - - // pub fn merge(&mut self, other: Self) { - // self.additional_factories += other.factory.duration().expect("should have duration"); - // self.additional_factory_times.push(TimeRange::with_value( - // *other - // .factory - // .range - // .start - // .get() - // .expect("should have duration"), - // *other.factory.range.end.get().expect("should have duration"), - // )); - // } } diff --git a/crates/rspack_core/src/stats.rs b/crates/rspack_core/src/stats.rs index 7150420a4eb..b199b1804bb 100644 --- a/crates/rspack_core/src/stats.rs +++ b/crates/rspack_core/src/stats.rs @@ -689,12 +689,10 @@ impl Stats<'_> { .transpose()?; let profile = if let Some(p) = mgm.get_profile() && let Some(factory) = p.factory.duration() - && let Some(integration) = p.integration.duration() && let Some(building) = p.building.duration() { Some(StatsModuleProfile { factory: StatsMillisecond::new(factory.as_secs(), factory.subsec_millis()), - integration: StatsMillisecond::new(integration.as_secs(), integration.subsec_millis()), building: StatsMillisecond::new(building.as_secs(), building.subsec_millis()), }) } else { @@ -1107,7 +1105,6 @@ pub enum StatsUsedExports { #[derive(Debug)] pub struct StatsModuleProfile { pub factory: StatsMillisecond, - pub integration: StatsMillisecond, pub building: StatsMillisecond, } diff --git a/packages/rspack-test-tools/tests/statsAPICases/profile.js b/packages/rspack-test-tools/tests/statsAPICases/profile.js index 822c25ab85e..369a83529d9 100644 --- a/packages/rspack-test-tools/tests/statsAPICases/profile.js +++ b/packages/rspack-test-tools/tests/statsAPICases/profile.js @@ -13,13 +13,13 @@ module.exports = { stats?.toString({ all: false, modules: true }).replace(/\d+ ms/g, "X ms") ).toMatchInlineSnapshot(` "./fixtures/abc.js 83 bytes [built] [code generated] - X ms (resolving: X ms, integration: X ms, building: X ms) + X ms (resolving: X ms, building: X ms) ./fixtures/a.js 55 bytes [built] [code generated] - X ms (resolving: X ms, integration: X ms, building: X ms) + X ms (resolving: X ms, building: X ms) ./fixtures/b.js 94 bytes [built] [code generated] - X ms (resolving: X ms, integration: X ms, building: X ms) + X ms (resolving: X ms, building: X ms) ./fixtures/c.js 72 bytes [built] [code generated] - X ms (resolving: X ms, integration: X ms, building: X ms)" + X ms (resolving: X ms, building: X ms)" `); } }; diff --git a/packages/rspack/etc/api.md b/packages/rspack/etc/api.md index 6c3f31fbac8..5ab0cb161ce 100644 --- a/packages/rspack/etc/api.md +++ b/packages/rspack/etc/api.md @@ -4396,7 +4396,6 @@ type KnownStatsPrinterContext = { type KnownStatsProfile = { total: number; resolving: number; - integration: number; building: number; }; diff --git a/packages/rspack/src/stats/DefaultStatsFactoryPlugin.ts b/packages/rspack/src/stats/DefaultStatsFactoryPlugin.ts index 1582e46f879..dc1fb89489c 100644 --- a/packages/rspack/src/stats/DefaultStatsFactoryPlugin.ts +++ b/packages/rspack/src/stats/DefaultStatsFactoryPlugin.ts @@ -877,12 +877,10 @@ const SIMPLE_EXTRACTORS: SimpleExtractors = { profile: { _: (object, profile) => { const factory = resolveStatsMillisecond(profile.factory); - const integration = resolveStatsMillisecond(profile.integration); const building = resolveStatsMillisecond(profile.building); const statsProfile: StatsProfile = { - total: factory + integration + building, + total: factory + building, resolving: factory, - integration, building }; Object.assign(object, statsProfile); diff --git a/packages/rspack/src/stats/statsFactoryUtils.ts b/packages/rspack/src/stats/statsFactoryUtils.ts index a475cbb5466..d13f6adb085 100644 --- a/packages/rspack/src/stats/statsFactoryUtils.ts +++ b/packages/rspack/src/stats/statsFactoryUtils.ts @@ -40,7 +40,6 @@ export type StatsProfile = KnownStatsProfile & Record; export type KnownStatsProfile = { total: number; resolving: number; - integration: number; building: number; };