File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -30,8 +30,13 @@ const measureTotalTimeAsSubtest = false; // Once we move to preloading all resou
3030const defaultIterationCount = 120 ;
3131const defaultWorstCaseCount = 4 ;
3232
33- if ( ! JetStreamParams . prefetchResources && isInBrowser )
33+ if ( ! JetStreamParams . prefetchResources && isInBrowser ) {
3434 console . warn ( "Disabling resource prefetching! All compressed files must have been decompressed using `npm run decompress`" ) ;
35+ }
36+
37+ if ( JetStreamParams . forceGC && typeof globalThis . gc === "undefined" ) {
38+ console . warn ( "Force-gc is set, but globalThis.gc() is not available." ) ;
39+ }
3540
3641if ( ! isInBrowser && JetStreamParams . prefetchResources ) {
3742 // Use the wasm compiled zlib as a polyfill when decompression stream is
@@ -982,6 +987,9 @@ class Benchmark {
982987 magicFrame . contentDocument . close ( ) ;
983988 else if ( isD8 )
984989 Realm . dispose ( magicFrame ) ;
990+
991+ if ( JetStreamParams . forceGC )
992+ globalThis ?. gc ( ) ;
985993 }
986994
987995 async doLoadBlob ( resource ) {
Original file line number Diff line number Diff line change @@ -81,6 +81,10 @@ const CLI_PARAMS = {
8181 help : "Custom code to run after each iteration." ,
8282 param : "customPostIterationCode" ,
8383 } ,
84+ "force-gc" : {
85+ help : "Force garbage collection after each benchmark run, requires engine support." ,
86+ param : "forceGC" ,
87+ } ,
8488} ;
8589
8690const cliParams = new Map ( ) ;
Original file line number Diff line number Diff line change @@ -43,6 +43,7 @@ class Params {
4343 groupDetails = false
4444
4545 RAMification = false ;
46+ forceGC = false ;
4647 dumpJSONResults = false ;
4748 dumpTestList = false ;
4849 // Override iteration and worst-case counts per workload.
@@ -70,6 +71,7 @@ class Params {
7071 this . dumpJSONResults = this . _parseBooleanParam ( sourceParams , "dumpJSONResults" ) ;
7172 this . groupDetails = this . _parseBooleanParam ( sourceParams , "groupDetails" ) ;
7273 this . dumpTestList = this . _parseBooleanParam ( sourceParams , "dumpTestList" ) ;
74+ this . forceGC = this . _parseBooleanParam ( sourceParams , "forceGC" ) ;
7375
7476 this . customPreIterationCode = this . _parseStringParam ( sourceParams , "customPreIterationCode" ) ;
7577 this . customPostIterationCode = this . _parseStringParam ( sourceParams , "customPostIterationCode" ) ;
You can’t perform that action at this time.
0 commit comments