Skip to content

Commit f6177c4

Browse files
committed
Merge branch 'main' into 2025-12-10_resources
2 parents 18ab3a1 + a3f5c45 commit f6177c4

4 files changed

Lines changed: 27 additions & 2 deletions

File tree

JetStreamDriver.js

Lines changed: 14 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
@@ -1031,6 +1036,14 @@ class Benchmark {
10311036
if (this.isDone)
10321037
throw new Error(`Cannot run Benchmark ${this.name} twice`);
10331038
this._state = BenchmarkState.PREPARE;
1039+
1040+
if (JetStreamParams.forceGC) {
1041+
// This will trigger for individual benchmarks in
1042+
// GroupedBenchmarks since they delegate .run() to their inner
1043+
// non-grouped benchmarks.
1044+
globalThis?.gc();
1045+
}
1046+
10341047
const scripts = isInBrowser ? new BrowserScripts(this.preloads) : new ShellScripts(this.preloads);
10351048

10361049
if (!!this.plan.deterministicRandom)

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 before each benchmark, requires engine support.",
86+
param: "forceGC",
87+
},
8488
};
8589

8690
const cliParams = new Map();

resources/JetStream.css

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
--benchmark-done-result-color: #4A4A4A;
4242
--gap: 3rem;
4343
--width: 200px;
44+
--nonDefaultRotate: 152deg;
4445
}
4546

4647
html,
@@ -73,7 +74,12 @@ table {
7374
}
7475

7576
body.nonDefaultParams {
76-
filter: hue-rotate(152deg);
77+
filter: hue-rotate(var(--nonDefaultRotate));
78+
}
79+
80+
/* error gets rotated too, rotate it back so it's still red */
81+
.nonDefaultParams .error {
82+
filter: hue-rotate(calc(360deg - var(--nonDefaultRotate)));
7783
}
7884

7985
.nonDefaultParams .summary {

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)