From 64ceef76d818ef4ffdbcdd50d35de2e4279b9b9e Mon Sep 17 00:00:00 2001 From: Camillo Bruni Date: Mon, 13 Oct 2025 12:18:35 +0200 Subject: [PATCH 1/6] non default params --- JetStream.css | 61 +++++++++++++++++++++++++++++++++++++++++++++++++++ cli.js | 2 +- index.html | 39 +++++++++++++++++++++++++++++++- 3 files changed, 100 insertions(+), 2 deletions(-) diff --git a/JetStream.css b/JetStream.css index b510f02f..a9638275 100644 --- a/JetStream.css +++ b/JetStream.css @@ -68,6 +68,67 @@ body { height: 100%; } +table { + border-spacing: 0; +} + +body.nonDefaultParams { + background: radial-gradient(circle at bottom,white 60%, var(--benchmark-error-text-color)); +} + +.nonDefaultParams .summary { + display: none; +} + +#non-default-params { + display: none; + text-align: center; + + & h2 { + color: var(--benchmark-error-text-color); + text-align: center; + } + + & p { + text-align: center; + } +} + +.nonDefaultParams #non-default-params { + display: block; +} + + + +#non-standard-params-table { + border-collapse: collapse; + text-align: left; + display: inline-block; + margin-top: var(--gap); +} + +#non-standard-params-table tr { + padding: 2px; +} + +#non-standard-params-table thead th { + border-bottom: 1px solid var(--foreground); +} + +#non-standard-params-table tbody td { + font-weight: normal; + text-align: left; +} + +#non-standard-params-table thead th, +#non-standard-params-table tbody td { + padding: 0.1em 0.3em; +} +#non-standard-params-table tbody td:nth-child(2) { + color: var(--highlight); +} + + .overflow-scroll { overflow-y: auto; } diff --git a/cli.js b/cli.js index 19e705e4..b9f08a2a 100644 --- a/cli.js +++ b/cli.js @@ -41,7 +41,7 @@ const CLI_PARAMS = { param: "dumpJSONResults", }, "dump-test-list": { - help: "Print test list instead of running.", + help: "Print the selected test list instead of running.", param: "dumpTestList", }, ramification: { diff --git a/index.html b/index.html index 09bd92b7..a603aa93 100644 --- a/index.html +++ b/index.html @@ -36,7 +36,9 @@ const isInBrowser = true; const isD8 = false; const isSpiderMonkey = false; - globalThis.JetStreamParamsSource = new URLSearchParams(globalThis?.location?.search); + if (globalThis?.location?.search) { + globalThis.JetStreamParamsSource = new URLSearchParams(globalThis?.location?.search); + } globalThis.allIsGood = true; window.onerror = function(e) { if (e == "Script error.") { @@ -49,6 +51,9 @@ } async function initialize() { + if (!JetStreamParams.isDefault) { + showNonDefaultParams(); + } if (globalThis.allIsGood) { try { await JetStream.initialize(); @@ -64,6 +69,21 @@ statusElement.innerHTML = "

ERROR

Errors were encountered during page load. Refusing to run a partial benchmark suite.

"; } } + + function showNonDefaultParams() { + document.body.classList.add("nonDefaultParams"); + const body = document.querySelector("#non-standard-params-table tbody"); + for (const [key, value] of Object.entries(JetStreamParams.nonDefaultParams)) { + let defaultValue = DefaultJetStreamParams[key] + if (defaultValue === "" || defaultValue === undefined || defaultValue?.length === 0) { + defaultValue = "—"; + } + const row = body.insertRow(); + row.insertCell().textContent = key; + row.insertCell().textContent = value; + row.insertCell().textContent = defaultValue; + } + } @@ -79,6 +99,23 @@

JetStream 3 is a JavaScript and WebAssembly benchmark suite focused on the most advanced web applications. It rewards browsers that start up quickly, execute code quickly, and run smoothly. For more information, read the in-depth analysis. Bigger scores are better.

+
+

Non-standard Parameters

+

+ JetStream ran with non-standard parameters.
+ The results are likely not comparable to default runs. +

+ + + + + + + + + +
ParamValueDefault
+

From bccb0889390c5d4302adce4ebd6a8771f838aae8 Mon Sep 17 00:00:00 2001 From: Camillo Bruni Date: Wed, 22 Oct 2025 11:09:11 +0200 Subject: [PATCH 2/6] fix params parsing and add more tests --- JetStream.css | 8 ++++++-- params.js | 17 ++++++++++++----- tests/unit-tests.js | 26 ++++++++++++++++++++++++++ 3 files changed, 44 insertions(+), 7 deletions(-) diff --git a/JetStream.css b/JetStream.css index 42d15eeb..be202f8e 100644 --- a/JetStream.css +++ b/JetStream.css @@ -72,8 +72,12 @@ table { border-spacing: 0; } -body.nonDefaultParams { - background: radial-gradient(circle at bottom,white 60%, var(--benchmark-error-text-color)); +.nonDefaultParams .logo .logo-image { + filter: hue-rotate(10deg); +} + +.nonDefaultParams #jetstreams { + filter: hue-rotate(152deg); } .nonDefaultParams .summary { diff --git a/params.js b/params.js index ab7ca5f8..08423f14 100644 --- a/params.js +++ b/params.js @@ -82,7 +82,7 @@ class Params { this.startDelay = 100; } - for (const paramKey of ["tag", "tags", "test", "tests"]) { + for (const paramKey of ["tag", "tags", "test", "tests", "testList"]) { this.testList = this._parseTestListParam(sourceParams, paramKey); } @@ -125,8 +125,11 @@ class Params { _parseBooleanParam(sourceParams, paramKey) { if (!sourceParams.has(paramKey)) return DefaultJetStreamParams[paramKey]; - const value = sourceParams.get(paramKey).toLowerCase(); + const rawValue = sourceParams.get(paramKey);; sourceParams.delete(paramKey); + if (rawValue === true || rawValue === false) + return true; + const value = rawValue.toLowerCase(); return !(value === "false" || value === "0"); } @@ -155,9 +158,10 @@ class Params { get nonDefaultParams() { const diff = Object.create(null); for (const [key, value] of Object.entries(this)) { - if (value !== DefaultJetStreamParams[key]) { - diff[key] = value; - } + const defaultValue = DefaultJetStreamParams[key] + if (value == defaultValue) continue; + if (value?.length == 0 && defaultValue?.length == 0) continue; + diff[key] = value; } return diff; } @@ -168,6 +172,9 @@ let maybeCustomParams = DefaultJetStreamParams; if (globalThis?.JetStreamParamsSource) { try { maybeCustomParams = new Params(globalThis?.JetStreamParamsSource); + if (Object.entries(maybeCustomParams.nonDefaultParams).length === 0) { + maybeCustomParams = DefaultJetStreamParams + } } catch (e) { console.error("Invalid Params", e, "\nUsing defaults as fallback:", maybeCustomParams); } diff --git a/tests/unit-tests.js b/tests/unit-tests.js index ac5d5e12..b586ad3c 100644 --- a/tests/unit-tests.js +++ b/tests/unit-tests.js @@ -276,3 +276,29 @@ async function testStartupBenchmarkInnerTests() { } ); })(); + +(function testDefaultParams() { + assertTrue(DefaultJetStreamParams.isDefault); + assertTrue(Object.isFrozen(DefaultJetStreamParams)); + assertEquals(Object.entries(DefaultJetStreamParams.nonDefaultParams).length, 0); +})(); + +(function testCustomParamsSingle() { + const sourceParams = new Map(Object.entries({ developerMode: true })); + const params = new Params(sourceParams); + assertFalse(params.isDefault); + const nonDefaults =params.nonDefaultParams + assertEquals(Object.entries(nonDefaults).length, 1); + assertEquals(nonDefaults.developerMode, true); +})(); + + +(function testCustomParamsMultiple() { + const sourceParams = new Map(Object.entries({ iterationCount: 123, test: "wasm,js"})); + const params = new Params(sourceParams); + assertFalse(params.isDefault); + const nonDefaults =params.nonDefaultParams + assertEquals(Object.entries(nonDefaults).length, 2); + assertEquals(nonDefaults.testIterationCount, 123); + assertEquals(JSON.stringify(nonDefaults.testList), JSON.stringify(["wasm", "js"])); +})(); \ No newline at end of file From 474b6972edc4541d509e03e7068d2ad5720d0a08 Mon Sep 17 00:00:00 2001 From: Camillo Bruni Date: Wed, 22 Oct 2025 14:58:36 +0200 Subject: [PATCH 3/6] fix --- index.html | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/index.html b/index.html index a603aa93..c1619b2c 100644 --- a/index.html +++ b/index.html @@ -74,14 +74,11 @@ document.body.classList.add("nonDefaultParams"); const body = document.querySelector("#non-standard-params-table tbody"); for (const [key, value] of Object.entries(JetStreamParams.nonDefaultParams)) { - let defaultValue = DefaultJetStreamParams[key] - if (defaultValue === "" || defaultValue === undefined || defaultValue?.length === 0) { - defaultValue = "—"; - } + const defaultValue = DefaultJetStreamParams[key] const row = body.insertRow(); row.insertCell().textContent = key; - row.insertCell().textContent = value; - row.insertCell().textContent = defaultValue; + row.insertCell().textContent = JSON.stringify(value); + row.insertCell().textContent = JSON.stringify(defaultValue); } } From e46ee6eb4435b06e66bb0c3e10ddc870f0b70b5f Mon Sep 17 00:00:00 2001 From: Camillo Bruni Date: Wed, 22 Oct 2025 15:01:10 +0200 Subject: [PATCH 4/6] use json compare --- params.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/params.js b/params.js index 08423f14..92c76e07 100644 --- a/params.js +++ b/params.js @@ -172,7 +172,8 @@ let maybeCustomParams = DefaultJetStreamParams; if (globalThis?.JetStreamParamsSource) { try { maybeCustomParams = new Params(globalThis?.JetStreamParamsSource); - if (Object.entries(maybeCustomParams.nonDefaultParams).length === 0) { + // We might have parsed the same values again, do a poor-mans deep-equals: + if (JSON.stringify(maybeCustomParams) === JSON.stringify(DefaultJetStreamParams)) { maybeCustomParams = DefaultJetStreamParams } } catch (e) { From ab7b02f6087a2420d676808563f51d20e3c82495 Mon Sep 17 00:00:00 2001 From: Camillo Bruni Date: Wed, 22 Oct 2025 17:45:10 +0200 Subject: [PATCH 5/6] address comments --- tests/unit-tests.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/unit-tests.js b/tests/unit-tests.js index 7c1e10a3..754e8fe0 100644 --- a/tests/unit-tests.js +++ b/tests/unit-tests.js @@ -310,7 +310,7 @@ async function testStartupBenchmarkInnerTests() { const sourceParams = new Map(Object.entries({ developerMode: "true" })); const params = new Params(sourceParams); assertFalse(params.isDefault); - const nonDefaults =params.nonDefaultParams + const nonDefaults = params.nonDefaultParams; assertEquals(Object.entries(nonDefaults).length, 1); assertEquals(nonDefaults.developerMode, true); })(); @@ -320,7 +320,7 @@ async function testStartupBenchmarkInnerTests() { const sourceParams = new Map(Object.entries({ iterationCount: 123, test: "wasm,js"})); const params = new Params(sourceParams); assertFalse(params.isDefault); - const nonDefaults =params.nonDefaultParams + const nonDefaults = params.nonDefaultParams; assertEquals(Object.entries(nonDefaults).length, 2); assertEquals(nonDefaults.testIterationCount, 123); assertEquals(JSON.stringify(nonDefaults.testList), JSON.stringify(["wasm", "js"])); From e656f5f7fd8dba40dfd78935c223959688a2b8e7 Mon Sep 17 00:00:00 2001 From: Camillo Bruni Date: Wed, 22 Oct 2025 17:49:06 +0200 Subject: [PATCH 6/6] full body hue rotate --- JetStream.css | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/JetStream.css b/JetStream.css index be202f8e..2ffba2de 100644 --- a/JetStream.css +++ b/JetStream.css @@ -72,11 +72,7 @@ table { border-spacing: 0; } -.nonDefaultParams .logo .logo-image { - filter: hue-rotate(10deg); -} - -.nonDefaultParams #jetstreams { +body.nonDefaultParams { filter: hue-rotate(152deg); } @@ -89,7 +85,6 @@ table { text-align: center; & h2 { - color: var(--benchmark-error-text-color); text-align: center; } @@ -102,8 +97,6 @@ table { display: block; } - - #non-standard-params-table { border-collapse: collapse; text-align: left;