diff --git a/README.md b/README.md index 47bfbf6ce..00dc5c116 100644 --- a/README.md +++ b/README.md @@ -147,9 +147,9 @@ The size of the bundles after the build. - `build-prepare-time`: the time taken from when the plugins are loaded to when the build prep process is fully completed. Corresponding hooks: `loadPlugin -> prepare`. - `build-cold-boot-time`: the time it takes for the build to complete without caching. Corresponding hooks: `beforeBuild -> afterBuild`. - `build-hot-boot-time`: the time it takes to complete a build with caching. Corresponding hooks: `beforeBuild -> afterBuild`. -- `bulid-cjs-time`: the time it takes to complete a build task for cjs in module build. Corresponding hooks: `beforeBuildTask -> afterBuildTask`. -- `bulid-esm-time`: the time it takes to complete a build task for esm in module build. Corresponding hooks: `beforeBuildTask -> afterBuildTask`. -- `bulid-dts-time`: the time it takes to complete a build task for dts in module build. Corresponding hooks: `beforeBuildTask -> afterBuildTask`. +- `build-cjs-time`: the time it takes to complete a build task for cjs in module build. Corresponding hooks: `beforeBuildTask -> afterBuildTask`. +- `build-esm-time`: the time it takes to complete a build task for esm in module build. Corresponding hooks: `beforeBuildTask -> afterBuildTask`. +- `build-dts-time`: the time it takes to complete a build task for dts in module build. Corresponding hooks: `beforeBuildTask -> afterBuildTask`. - `route-generate-time`: the time it takes to generate routes in rspress. Corresponding hooks: `beforeBuild -> routeGenerated`. - `before-dev-time`: the time it takes for the dev command to initialize, in other words, cli cold boot time. - `before-build-time`: the time it takes for the build command to initialize, in other words, cli cold boot time. diff --git a/scripts/src/compare.ts b/scripts/src/compare.ts index 45cf235a1..fce47c6fd 100644 --- a/scripts/src/compare.ts +++ b/scripts/src/compare.ts @@ -42,7 +42,6 @@ function generateTable( ) { const overThresholdTags: string[] = []; const properties = Object.keys(base); - const limited = caseName.startsWith('module-') ? 10 : 5; const maxPropertyLength = Math.max(...properties.map(p => p.length)); @@ -57,6 +56,13 @@ function generateTable( properties.forEach(property => { if (property === 'time') return; + + const limited = + caseName.startsWith('module-') && + property.toLowerCase().indexOf('build') > -1 + ? 15 + : 5; + const percent = ((current[property] - base[property]) * 100) / base[property]; const formattedPercent = diff --git a/scripts/src/plugins/modernjs-module/measure-plugin.ts b/scripts/src/plugins/modernjs-module/measure-plugin.ts index 63ceb6187..a9a5da751 100644 --- a/scripts/src/plugins/modernjs-module/measure-plugin.ts +++ b/scripts/src/plugins/modernjs-module/measure-plugin.ts @@ -14,7 +14,7 @@ export const measurePlugin = () => ({ setup(api: any) { let beforeBuildTime: number; - let beforeBulidCjsTime: number; + let beforeBuildCjsTime: number; let beforeBuildEsmTime: number; let beforeBuildDtsTime: number; @@ -33,7 +33,7 @@ export const measurePlugin = () => ({ if (config.dts === false) { if (config.format === 'cjs') { // build cjs - beforeBulidCjsTime = performance.now(); + beforeBuildCjsTime = performance.now(); } else if (config.format === 'esm') { // build esm beforeBuildEsmTime = performance.now(); @@ -48,14 +48,14 @@ export const measurePlugin = () => ({ if (options.config.dts === false) { if (options.config.format === 'cjs') { // build cjs - metrics.bulidCjsTime = performance.now() - beforeBulidCjsTime; + metrics.buildCjsTime = performance.now() - beforeBuildCjsTime; } else if (options.config.format === 'esm') { // build esm - metrics.bulidEsmTime = performance.now() - beforeBuildEsmTime; + metrics.buildEsmTime = performance.now() - beforeBuildEsmTime; } } else { // build dts - metrics.bulidDtsTime = performance.now() - beforeBuildDtsTime; + metrics.buildDtsTime = performance.now() - beforeBuildDtsTime; } }, diff --git a/scripts/src/shared/types.ts b/scripts/src/shared/types.ts index 10b66131a..654bcfd0d 100644 --- a/scripts/src/shared/types.ts +++ b/scripts/src/shared/types.ts @@ -14,10 +14,9 @@ export type Metrics = { buildColdBootTime?: number; buildPluginSetupTime?: number; buildPrepareTime?: number; - beforeBulidCjsTime?: number; - bulidCjsTime?: number; - bulidEsmTime?: number; - bulidDtsTime?: number; + buildCjsTime?: number; + buildEsmTime?: number; + buildDtsTime?: number; routeGenerateTime?: number; // Bundle size diff --git a/website/src/shared/constant.ts b/website/src/shared/constant.ts index 8d8ebe0a2..7a51e02ae 100644 --- a/website/src/shared/constant.ts +++ b/website/src/shared/constant.ts @@ -103,9 +103,9 @@ export const COMPILE_SPEED_METRICS = { 'buildColdBootTime', 'beforeBuildTime', 'buildPluginSetupTime', - 'bulidCjsTime', - 'bulidEsmTime', - 'bulidDtsTime', + 'buildCjsTime', + 'buildEsmTime', + 'buildDtsTime', ], [PRODUCT.RSPRESS]: [ 'buildColdBootTime',