Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
65 changes: 65 additions & 0 deletions JetStream.css
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,71 @@ body {
height: 100%;
}

table {
border-spacing: 0;
}

.nonDefaultParams .logo .logo-image {
filter: hue-rotate(10deg);
}

.nonDefaultParams #jetstreams {
filter: hue-rotate(152deg);
}

.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;
}
Expand Down
2 changes: 1 addition & 1 deletion cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand Down
39 changes: 38 additions & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -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.") {
Expand All @@ -49,6 +51,9 @@
}

async function initialize() {
if (!JetStreamParams.isDefault) {
showNonDefaultParams();
}
if (globalThis.allIsGood) {
try {
await JetStream.initialize();
Expand All @@ -64,6 +69,21 @@
statusElement.innerHTML = "<h2>ERROR</h2><p>Errors were encountered during page load. Refusing to run a partial benchmark suite.</p>";
}
}

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;
}
}
</script>

<script src="params.js"></script>
Expand All @@ -79,6 +99,23 @@ <h1 class="logo">

<main>
<p class="summary">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 <a href="in-depth.html">in-depth analysis</a>. Bigger scores are better.</p>
<div id="non-default-params">
<h2>Non-standard Parameters</h2>
<p>
JetStream ran with non-standard parameters.<br />
The results are likely not comparable to default runs.
</p>
<table id="non-standard-params-table">
<thead>
<tr>
<th>Param</th>
<th>Value</th>
<th>Default</th>
</tr>
</thead>
<tbody></tbody>
</table>
</div>
<p class="summary" id="mode-description"></p>

<div id="result-summary"></div>
Expand Down
17 changes: 12 additions & 5 deletions params.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down Expand Up @@ -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");
}

Expand Down Expand Up @@ -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;
}
Expand All @@ -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);
}
Expand Down
26 changes: 26 additions & 0 deletions tests/unit-tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -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"]));
})();
Loading