Skip to content

Commit d1c22b6

Browse files
committed
fixes
1 parent 515ab50 commit d1c22b6

3 files changed

Lines changed: 15 additions & 1 deletion

File tree

JetStreamDriver.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,13 @@ const measureTotalTimeAsSubtest = false; // Once we move to preloading all resou
3030
const defaultIterationCount = 120;
3131
const 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

3641
if (!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) {

cli.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff 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

8690
const cliParams = new Map();

utils/params.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff 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");

0 commit comments

Comments
 (0)