@@ -19,6 +19,7 @@ import {
1919 addRankingEmojis ,
2020 shuffleArray ,
2121 sleep ,
22+ N_A ,
2223} from './utils.ts' ;
2324
2425process . env . CASE = caseName ;
@@ -115,6 +116,7 @@ interface BuildToolOptions {
115116 startedRegex : RegExp ;
116117 buildScript : string ;
117118 binFilePath : string ;
119+ skipRss ?: boolean ;
118120}
119121
120122class BuildTool {
@@ -124,6 +126,7 @@ class BuildTool {
124126 private readonly startedRegex : RegExp ;
125127 private readonly buildScript : string ;
126128 private readonly binFilePath : string ;
129+ public readonly skipRss : boolean ;
127130
128131 constructor ( {
129132 name,
@@ -132,6 +135,7 @@ class BuildTool {
132135 startedRegex,
133136 buildScript,
134137 binFilePath,
138+ skipRss = false ,
135139 } : BuildToolOptions ) {
136140 this . name = name ;
137141 this . port = port ;
@@ -140,6 +144,7 @@ class BuildTool {
140144 this . buildScript = buildScript ;
141145 this . binFilePath = path . join ( process . cwd ( ) , 'node_modules' , binFilePath ) ;
142146 this . hackBinFile ( ) ;
147+ this . skipRss = skipRss ;
143148 }
144149
145150 cleanCache ( ) : void {
@@ -418,6 +423,8 @@ parseToolNames().forEach((name) => {
418423 startedRegex : / e s b u i l d b u i l t i n ( \d + ) m s / ,
419424 buildScript : 'build:esbuild' ,
420425 binFilePath : 'esbuild/lib/main.js' ,
426+ // can not collect accurate RSS from esbuild
427+ skipRss : true ,
421428 } ) ,
422429 ) ;
423430 break ;
@@ -504,7 +511,7 @@ async function runDevBenchmark(
504511 const loadTime = Date . now ( ) - start ;
505512 logger . success (
506513 color . dim ( buildTool . name ) +
507- ' dev cold start in ' +
514+ ' dev start in ' +
508515 color . green ( time + loadTime + 'ms' ) ,
509516 ) ;
510517 metrics . devColdStart = time + loadTime ;
@@ -622,7 +629,7 @@ async function runHotStartBenchmark(
622629
623630 logger . info (
624631 color . dim (
625- 'navigating to' + ` http://localhost:${ buildTool . port } (hot start )` ,
632+ 'navigating to' + ` http://localhost:${ buildTool . port } (with cache )` ,
626633 ) ,
627634 ) ;
628635
@@ -637,7 +644,7 @@ async function runHotStartBenchmark(
637644 const loadTime = Date . now ( ) - start ;
638645 logger . success (
639646 color . dim ( buildTool . name ) +
640- ' dev hot start in ' +
647+ ' dev start with cache in ' +
641648 color . green ( time + loadTime + 'ms' ) ,
642649 ) ;
643650 metrics . devHotStart = time + loadTime ;
@@ -647,7 +654,7 @@ async function runHotStartBenchmark(
647654 await stopServer ( ) ;
648655
649656 await coolDown ( ) ;
650- logger . success ( color . dim ( buildTool . name ) + ' dev server closed (hot start )' ) ;
657+ logger . success ( color . dim ( buildTool . name ) + ' dev server closed (with cache )' ) ;
651658}
652659
653660async function runBuildBenchmark (
@@ -700,7 +707,7 @@ async function runHotBuildBenchmark(
700707
701708 logger . success (
702709 color . dim ( buildTool . name ) +
703- ' hot built in ' +
710+ ' built with cache in ' +
704711 color . green ( buildTime + 'ms' ) ,
705712 ) ;
706713
@@ -791,7 +798,16 @@ const getData = function (
791798 // and should be hidden
792799 return null ;
793800 }
794- const normalized = dataset . map ( ( item ) => `${ item as number | string } ${ unit } ` ) ;
801+
802+ const normalized = dataset . map ( ( item , index ) => {
803+ if (
804+ buildTools [ index ] . skipRss &&
805+ [ 'devRSS' , 'buildRSS' ] . includes ( fieldName )
806+ ) {
807+ return N_A ;
808+ }
809+ return `${ item as number | string } ${ unit } ` ;
810+ } ) ;
795811 addRankingEmojis ( normalized ) ;
796812 return normalized ;
797813} ;
0 commit comments