From e54d10421c9840764eb43c4a63eb149f134af7bb Mon Sep 17 00:00:00 2001 From: Camillo Bruni Date: Wed, 27 Aug 2025 16:18:08 +0200 Subject: [PATCH 01/14] show subtimes --- JetStream.css | 7 ++ JetStreamDriver.js | 196 ++++++++++++++++++++++++++++++++------------- 2 files changed, 149 insertions(+), 54 deletions(-) diff --git a/JetStream.css b/JetStream.css index 948754fe..c104f5f6 100644 --- a/JetStream.css +++ b/JetStream.css @@ -328,6 +328,13 @@ a.button { } +.benchmark .result.detail { + display: none; +} +.details .benchmark .result.detail { + display: inline-block; +} + .benchmark h4, .benchmark .result, .benchmark label, diff --git a/JetStreamDriver.js b/JetStreamDriver.js index 0ef099ba..182d0d89 100644 --- a/JetStreamDriver.js +++ b/JetStreamDriver.js @@ -88,25 +88,11 @@ if (!globalThis.prefetchResources) this.currentResolve = null; this.currentReject = null; -let showScoreDetails = false; -let categoryScores = null; - function displayCategoryScores() { - if (!categoryScores) - return; + document.body.classList.add("details"); - let scoreDetails = `
`; - for (let [category, scores] of categoryScores) { - scoreDetails += ` - ${uiFriendlyScore(geomeanScore(scores))} - - `; - } - scoreDetails += "
"; - let summaryElement = document.getElementById("result-summary"); - summaryElement.innerHTML += scoreDetails; - categoryScores = null; + // categoryScores = null; } function getIterationCount(plan) { @@ -132,19 +118,23 @@ function getWorstCaseCount(plan) { if (isInBrowser) { document.onkeydown = (keyboardEvent) => { const key = keyboardEvent.key; - if (key === "d" || key === "D") { - showScoreDetails = true; + if (key === "d" || key === "D") displayCategoryScores(); - } }; } -function mean(values) { +function sum(values) { console.assert(values instanceof Array); let sum = 0; for (let x of values) sum += x; - return sum / values.length; + return sum; +} + + +function mean(values) { + const totalSum = sum(values) + return totalSum / values.length; } function geomeanScore(values) { @@ -186,7 +176,7 @@ function uiFriendlyScore(num) { } function uiFriendlyDuration(time) { - return `${time.toFixed(3)} ms`; + return `${time.toFixed(2)} ms`; } // TODO: Cleanup / remove / merge. This is only used for caching loads in the @@ -288,10 +278,13 @@ class Driver { allScores.push(score); } - categoryScores = new Map; + const categoryScores = new Map(); + const categoryTimes = new Map(); for (const benchmark of this.benchmarks) { for (let category of Object.keys(benchmark.subScores())) categoryScores.set(category, []); + for (let category of Object.keys(benchmark.subTimes())) + categoryTimes.set(category, []); } for (const benchmark of this.benchmarks) { @@ -300,19 +293,37 @@ class Driver { console.assert(value > 0, `Invalid ${benchmark.name} ${category} score: ${value}`); arr.push(value); } + for (let [category, value] of Object.entries(benchmark.subTimes())) { + const arr = categoryTimes.get(category); + console.assert(value > 0, `Invalid ${benchmark.name} ${category} score: ${value}`); + arr.push(value); + } } const totalScore = geomeanScore(allScores); console.assert(totalScore > 0, `Invalid total score: ${totalScore}`); if (isInBrowser) { + let summaryHtml = `
${uiFriendlyScore(totalScore)}
+ `; + summaryHtml += `
`; + for (let [category, scores] of categoryScores) { + summaryHtml += ` + ${uiFriendlyScore(geomeanScore(scores))} + + `; + } + for (let [category, times] of categoryTimes) { + summaryHtml += ` + ${uiFriendlyDuration(geomeanScore(times))} + + `; + } + summaryHtml += "
"; const summaryElement = document.getElementById("result-summary"); summaryElement.classList.add("done"); - summaryElement.innerHTML = `
${uiFriendlyScore(totalScore)}
- `; + summaryElement.innerHTML = summaryHtml; summaryElement.onclick = displayCategoryScores; - if (showScoreDetails) - displayCategoryScores(); statusElement.innerHTML = ""; } else if (!dumpJSONResults) { console.log("\n"); @@ -335,33 +346,37 @@ class Driver { prepareToRun() { this.benchmarks.sort((a, b) => a.plan.name.toLowerCase() < b.plan.name.toLowerCase() ? 1 : -1); + if (!isInBrowser) + return; + let text = ""; for (const benchmark of this.benchmarks) { - const description = Object.keys(benchmark.subScores()); - description.push("Score"); + const scoreDescription = Object.keys(benchmark.allScores()); + const timeDescription = Object.keys(benchmark.allTimes()); const scoreIds = benchmark.scoreIdentifiers(); const overallScoreId = scoreIds.pop(); - - if (isInBrowser) { - text += - `
-

${benchmark.name} i

-

 

-

 

-

`; - for (let i = 0; i < scoreIds.length; i++) { - const scoreId = scoreIds[i]; - const label = description[i]; - text += ` ` - } - text += `

`; + const timeIds = benchmark.timeIdentifiers(); + + text += + `
+

${benchmark.name} i

+

 

+

 

+

`; + for (let i = 0; i < scoreIds.length; i++) { + const scoreId = scoreIds[i]; + const label = scoreDescription[i]; + text += ` ` } + for (let i = 0; i < timeIds.length; i++) { + const timeId = timeIds[i]; + const label = timeDescription[i]; + text += ` ` + } + text += `

`; } - if (!isInBrowser) - return; - for (let f = 0; f < 5; f++) text += `
`; @@ -383,12 +398,13 @@ class Driver { if (!isInBrowser) return; - for (const id of benchmark.scoreIdentifiers()) { + for (const id of benchmark.scoreIdentifiers()) document.getElementById(id).innerHTML = "error"; - const benchmarkResultsUI = document.getElementById(`benchmark-${benchmark.name}`); - benchmarkResultsUI.classList.remove("benchmark-running"); - benchmarkResultsUI.classList.add("benchmark-error"); - } + for (const id of benchmark.timeIdentifiers()) + document.getElementById(id).innerHTML = "error"; + const benchmarkResultsUI = document.getElementById(`benchmark-${benchmark.name}`); + benchmarkResultsUI.classList.remove("benchmark-running"); + benchmarkResultsUI.classList.add("benchmark-error"); } pushError(name, error) { @@ -777,16 +793,36 @@ class Benchmark { return geomeanScore(subScores); } + get totalTime() { + const subTimes = Object.values(this.subTimes()); + return sum(subTimes); + } + + get wallTime() { + return this.endTime - this.startTime; + } + subScores() { throw new Error("Subclasses need to implement this"); } + subTimes() { + throw new Error("Subclasses need to implement this"); + } + allScores() { const allScores = this.subScores(); allScores["Score"] = this.score; return allScores; } + allTimes() { + const allTimes = this.subTimes(); + allTimes["Total"] = this.totalTime; + allTimes["Wall-Time"] = this.wallTime; + return allTimes; + } + get prerunCode() { return null; } get preIterationCode() { @@ -1056,6 +1092,15 @@ class Benchmark { return `results-cell-${this.name}-${scoreName}`; } + timeIdentifiers() { + const ids = Object.keys(this.allTimes()).map(name => this.timeIdentifier(name)); + return ids; + } + + timeIdentifier(scoreName) { + return `results-cell-${this.name}-${scoreName}-time`; + } + updateUIBeforeRun() { if (!dumpJSONResults) console.log(`Running ${this.name}:`); @@ -1071,24 +1116,29 @@ class Benchmark { for (const id of this.scoreIdentifiers()) document.getElementById(id).innerHTML = "..."; + for (const id of this.timeIdentifiers()) + document.getElementById(id).innerHTML = "..."; } updateUIAfterRun() { const scoreEntries = Object.entries(this.allScores()); + const timeEntries = Object.entries(this.allTimes()); if (isInBrowser) - this.updateUIAfterRunInBrowser(scoreEntries); + this.updateUIAfterRunInBrowser(scoreEntries, timeEntries); if (dumpJSONResults) return; - this.updateConsoleAfterRun(scoreEntries); + this.updateConsoleAfterRun(scoreEntries, timeEntries); } - updateUIAfterRunInBrowser(scoreEntries) { + updateUIAfterRunInBrowser(scoreEntries, timeEntries) { const benchmarkResultsUI = document.getElementById(`benchmark-${this.name}`); benchmarkResultsUI.classList.remove("benchmark-running"); benchmarkResultsUI.classList.add("benchmark-done"); for (const [name, value] of scoreEntries) document.getElementById(this.scoreIdentifier(name)).innerHTML = uiFriendlyScore(value); + for (const [name, value] of timeEntries) + document.getElementById(this.timeIdentifier(name)).innerHTML = uiFriendlyDuration(value); this.renderScatterPlot(); } @@ -1225,6 +1275,22 @@ class GroupedBenchmark extends Benchmark { results[subScore] = geomeanScore(results[subScore]); return results; } + + subTimes() { + const results = {}; + + for (const benchmark of this.benchmarks) { + let times = benchmark.subTimes(); + for (let subTime in times) { + results[subTime] ??= []; + results[subTime].push(times[subTime]); + } + } + + for (let subTimes in results) + results[subTimes] = sum(results[subTimes]); + return results; + } }; class DefaultBenchmark extends Benchmark { @@ -1269,6 +1335,14 @@ class DefaultBenchmark extends Benchmark { "Average": this.averageScore, }; } + + subTimes() { + return { + "First": this.firstIterationTime, + "Worst": this.worstTime, + "Average": this.averageTime, + }; + } } class AsyncBenchmark extends DefaultBenchmark { @@ -1433,6 +1507,13 @@ class WSLBenchmark extends Benchmark { }`; } + subTimes() { + return { + "Stdlib": this.stdlibTime, + "MainRun": this.mainRunTime, + }; + } + subScores() { return { "Stdlib": this.stdlibScore, @@ -1570,6 +1651,13 @@ class WasmLegacyBenchmark extends Benchmark { "Runtime": this.runScore, }; } + + subTimes() { + return { + "Startup": this.startupTime, + "Runtime": this.runTim, + }; + } }; function dotnetPreloads(type) From 0762f1b72a08016f93fc1ee924651aaa185dc2a0 Mon Sep 17 00:00:00 2001 From: Camillo Bruni Date: Wed, 27 Aug 2025 17:20:36 +0200 Subject: [PATCH 02/14] fix accessor --- JetStreamDriver.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/JetStreamDriver.js b/JetStreamDriver.js index 182d0d89..9e35caed 100644 --- a/JetStreamDriver.js +++ b/JetStreamDriver.js @@ -295,7 +295,7 @@ class Driver { } for (let [category, value] of Object.entries(benchmark.subTimes())) { const arr = categoryTimes.get(category); - console.assert(value > 0, `Invalid ${benchmark.name} ${category} score: ${value}`); + console.assert(value > 0, `Invalid ${benchmark.name} ${category} time: ${value}`); arr.push(value); } } @@ -1655,7 +1655,7 @@ class WasmLegacyBenchmark extends Benchmark { subTimes() { return { "Startup": this.startupTime, - "Runtime": this.runTim, + "Runtime": this.runTime, }; } }; From 3af3b63ec0b146092f7c3962ceec4aa8279c897a Mon Sep 17 00:00:00 2001 From: Camillo Bruni Date: Wed, 3 Sep 2025 13:37:59 +0200 Subject: [PATCH 03/14] improve output --- JetStreamDriver.js | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/JetStreamDriver.js b/JetStreamDriver.js index ceb9405b..a8e6a26b 100644 --- a/JetStreamDriver.js +++ b/JetStreamDriver.js @@ -329,7 +329,11 @@ class Driver { console.log("\n"); for (let [category, scores] of categoryScores) console.log(`${category}: ${uiFriendlyScore(geomeanScore(scores))}`); - console.log("\nTotal Score: ", uiFriendlyScore(totalScore), "\n"); + for (let [category, times] of categoryTimes) + console.log(`${category}-Time: ${uiFriendlyDuration(geomeanScore(times))}`); + console.log(""); + console.log("Total Score: ", uiFriendlyScore(totalScore)); + console.log("Total Time: ", uiFriendlyDuration(totalTime)); } this.reportScoreToRunBenchmarkRunner(); @@ -825,8 +829,8 @@ class Benchmark { allTimes() { const allTimes = this.subTimes(); + allTimes["Wall"] = this.wallTime; allTimes["Total"] = this.totalTime; - allTimes["Wall-Time"] = this.wallTime; return allTimes; } @@ -1177,15 +1181,25 @@ class Benchmark { plotContainer.innerHTML = `${circlesSVG}`; } - updateConsoleAfterRun(scoreEntries) { + updateConsoleAfterRun(scoreEntries, timeEntries) { + const namePadding = 19; + const durationUnitPadding = " "; + const valuePadding = 10; for (let [name, value] of scoreEntries) { - console.log(` ${name}:`, uiFriendlyScore(value)); + console.log( + ` ${name}:`.padEnd(namePadding), + (uiFriendlyScore(value) + durationUnitPadding).padStart(valuePadding)); + } + for (let [name, value] of timeEntries) { + console.log( + ` ${name}-Time:`.padEnd(namePadding), + uiFriendlyDuration(value).padStart(valuePadding)); } if (RAMification) { console.log(" Current Footprint:", uiFriendlyNumber(this.currentFootprint)); console.log(" Peak Footprint:", uiFriendlyNumber(this.peakFootprint)); } - console.log(" Wall-Time:", uiFriendlyDuration(this.endTime - this.startTime)); + console.log(""); } }; From 4ff964962451d648b6562da2e5ecd90a5c96c949 Mon Sep 17 00:00:00 2001 From: Camillo Bruni Date: Wed, 3 Sep 2025 13:49:58 +0200 Subject: [PATCH 04/14] update scoring --- JetStreamDriver.js | 48 ++++++++++++++++++++++++++++++---------------- 1 file changed, 32 insertions(+), 16 deletions(-) diff --git a/JetStreamDriver.js b/JetStreamDriver.js index a8e6a26b..38325ccd 100644 --- a/JetStreamDriver.js +++ b/JetStreamDriver.js @@ -90,9 +90,6 @@ this.currentReject = null; function displayCategoryScores() { document.body.classList.add("details"); - - - // categoryScores = null; } function getIterationCount(plan) { @@ -179,6 +176,22 @@ function uiFriendlyDuration(time) { return `${time.toFixed(2)} ms`; } + +function shellFriendlyLabel(label) { + const namePadding = 19; + return `${label}:`.padEnd(namePadding); +} + +const valuePadding = 10; +function shellFriendlyDuration(time) { + return `${uiFriendlyDuration(time)}`.padStart(valuePadding); +} + +function shellFriendlyScore(time) { + return `${uiFriendlyScore(time)} `.padStart(valuePadding); +} + + // TODO: Cleanup / remove / merge. This is only used for caching loads in the // non-browser setting. In the browser we use exclusively `loadCache`, // `loadBlob`, `doLoadBlob`, `prefetchResourcesForBrowser` etc., see below. @@ -327,13 +340,19 @@ class Driver { statusElement.innerHTML = ""; } else if (!dumpJSONResults) { console.log("\n"); - for (let [category, scores] of categoryScores) - console.log(`${category}: ${uiFriendlyScore(geomeanScore(scores))}`); - for (let [category, times] of categoryTimes) - console.log(`${category}-Time: ${uiFriendlyDuration(geomeanScore(times))}`); + for (let [category, scores] of categoryScores) { + console.log( + shellFriendlyLabel(category), + shellFriendlyScore(geomeanScore(scores))); + } + for (let [category, times] of categoryTimes) { + console.log( + shellFriendlyLabel(`${category}-Time:`), + shellFriendlyDuration(geomeanScore(times))); + } console.log(""); - console.log("Total Score: ", uiFriendlyScore(totalScore)); - console.log("Total Time: ", uiFriendlyDuration(totalTime)); + console.log(shellFriendlyLabel("Total Score:"), shellFriendlyScore(totalScore)); + console.log(shellFriendlyLabel("Total Time:"), shellFriendlyDuration(totalTime)); } this.reportScoreToRunBenchmarkRunner(); @@ -1182,18 +1201,15 @@ class Benchmark { } updateConsoleAfterRun(scoreEntries, timeEntries) { - const namePadding = 19; - const durationUnitPadding = " "; - const valuePadding = 10; for (let [name, value] of scoreEntries) { console.log( - ` ${name}:`.padEnd(namePadding), - (uiFriendlyScore(value) + durationUnitPadding).padStart(valuePadding)); + shellFriendlyLabel(` ${name}`), + shellFriendlyScore(value)); } for (let [name, value] of timeEntries) { console.log( - ` ${name}-Time:`.padEnd(namePadding), - uiFriendlyDuration(value).padStart(valuePadding)); + shellFriendlyLabel(` ${name}-Time`), + shellFriendlyDuration(value)); } if (RAMification) { console.log(" Current Footprint:", uiFriendlyNumber(this.currentFootprint)); From 5d538cfa6a5341a57ee0a7d5a1be34d78db38b48 Mon Sep 17 00:00:00 2001 From: Camillo Bruni Date: Wed, 3 Sep 2025 13:51:40 +0200 Subject: [PATCH 05/14] fix --- JetStreamDriver.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/JetStreamDriver.js b/JetStreamDriver.js index 38325ccd..160c1e50 100644 --- a/JetStreamDriver.js +++ b/JetStreamDriver.js @@ -339,7 +339,7 @@ class Driver { summaryElement.onclick = displayCategoryScores; statusElement.innerHTML = ""; } else if (!dumpJSONResults) { - console.log("\n"); + console.log(""); for (let [category, scores] of categoryScores) { console.log( shellFriendlyLabel(category), @@ -353,6 +353,7 @@ class Driver { console.log(""); console.log(shellFriendlyLabel("Total Score:"), shellFriendlyScore(totalScore)); console.log(shellFriendlyLabel("Total Time:"), shellFriendlyDuration(totalTime)); + console.log(""); } this.reportScoreToRunBenchmarkRunner(); From 4be917784311c501c99c0454a6204419ca0fc61d Mon Sep 17 00:00:00 2001 From: Camillo Bruni Date: Wed, 3 Sep 2025 13:55:49 +0200 Subject: [PATCH 06/14] add total newlines --- JetStreamDriver.js | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/JetStreamDriver.js b/JetStreamDriver.js index 160c1e50..87ce2035 100644 --- a/JetStreamDriver.js +++ b/JetStreamDriver.js @@ -322,15 +322,16 @@ class Driver { summaryHtml += `
`; for (let [category, scores] of categoryScores) { summaryHtml += ` - ${uiFriendlyScore(geomeanScore(scores))} - - `; + ${uiFriendlyScore(geomeanScore(scores))} + + `; } + summaryHtml += "
"; for (let [category, times] of categoryTimes) { summaryHtml += ` - ${uiFriendlyDuration(geomeanScore(times))} - - `; + ${uiFriendlyDuration(geomeanScore(times))} + + `; } summaryHtml += "
"; const summaryElement = document.getElementById("result-summary"); @@ -393,6 +394,7 @@ class Driver { const label = scoreDescription[i]; text += ` ` } + text += "
"; for (let i = 0; i < timeIds.length; i++) { const timeId = timeIds[i]; const label = timeDescription[i]; From 5560aec9817ea4717d693912d4e48b9fd329e525 Mon Sep 17 00:00:00 2001 From: Camillo Bruni Date: Wed, 3 Sep 2025 16:22:33 +0200 Subject: [PATCH 07/14] addressing comments --- JetStreamDriver.js | 65 ++++++++++++++++++++++------------------------ 1 file changed, 31 insertions(+), 34 deletions(-) diff --git a/JetStreamDriver.js b/JetStreamDriver.js index 87ce2035..a2398d6d 100644 --- a/JetStreamDriver.js +++ b/JetStreamDriver.js @@ -128,7 +128,6 @@ function sum(values) { return sum; } - function mean(values) { const totalSum = sum(values) return totalSum / values.length; @@ -379,9 +378,9 @@ class Driver { const scoreDescription = Object.keys(benchmark.allScores()); const timeDescription = Object.keys(benchmark.allTimes()); - const scoreIds = benchmark.scoreIdentifiers(); + const scoreIds = benchmark.allScoreIdentifiers(); const overallScoreId = scoreIds.pop(); - const timeIds = benchmark.timeIdentifiers(); + const timeIds = benchmark.allTimeIdentifiers(); text += `
@@ -424,9 +423,9 @@ class Driver { if (!isInBrowser) return; - for (const id of benchmark.scoreIdentifiers()) + for (const id of benchmark.allScoreIdentifiers()) document.getElementById(id).innerHTML = "error"; - for (const id of benchmark.timeIdentifiers()) + for (const id of benchmark.allTimeIdentifiers()) document.getElementById(id).innerHTML = "error"; const benchmarkResultsUI = document.getElementById(`benchmark-${benchmark.name}`); benchmarkResultsUI.classList.remove("benchmark-running"); @@ -1116,7 +1115,7 @@ class Benchmark { this.preloads = Object.entries(this.plan.preload ?? {}); } - scoreIdentifiers() { + allScoreIdentifiers() { const ids = Object.keys(this.allScores()).map(name => this.scoreIdentifier(name)); return ids; } @@ -1125,7 +1124,7 @@ class Benchmark { return `results-cell-${this.name}-${scoreName}`; } - timeIdentifiers() { + allTimeIdentifiers() { const ids = Object.keys(this.allTimes()).map(name => this.timeIdentifier(name)); return ids; } @@ -1146,35 +1145,51 @@ class Benchmark { resultsBenchmarkUI.classList.add("benchmark-running"); resultsBenchmarkUI.scrollIntoView({ block: "nearest" }); - for (const id of this.scoreIdentifiers()) + for (const id of this.allScoreIdentifiers()) document.getElementById(id).innerHTML = "..."; - for (const id of this.timeIdentifiers()) + for (const id of this.allTimeIdentifiers()) document.getElementById(id).innerHTML = "..."; } updateUIAfterRun() { - const scoreEntries = Object.entries(this.allScores()); - const timeEntries = Object.entries(this.allTimes()); if (isInBrowser) - this.updateUIAfterRunInBrowser(scoreEntries, timeEntries); + this.updateUIAfterRunInBrowser(); if (dumpJSONResults) return; - this.updateConsoleAfterRun(scoreEntries, timeEntries); + this.updateConsoleAfterRun(); } - updateUIAfterRunInBrowser(scoreEntries, timeEntries) { + updateUIAfterRunInBrowser() { const benchmarkResultsUI = document.getElementById(`benchmark-${this.name}`); benchmarkResultsUI.classList.remove("benchmark-running"); benchmarkResultsUI.classList.add("benchmark-done"); - for (const [name, value] of scoreEntries) + for (const [name, value] of Object.entries(this.allScores())) document.getElementById(this.scoreIdentifier(name)).innerHTML = uiFriendlyScore(value); - for (const [name, value] of timeEntries) + for (const [name, value] of Object.entries(this.allTimes())) document.getElementById(this.timeIdentifier(name)).innerHTML = uiFriendlyDuration(value); this.renderScatterPlot(); } + updateConsoleAfterRun() { + for (let [name, value] of Object.entries(this.allScores())) { + console.log( + shellFriendlyLabel(` ${name}`), + shellFriendlyScore(value)); + } + for (let [name, value] of Object.entries(this.allTimes())) { + console.log( + shellFriendlyLabel(` ${name}-Time`), + shellFriendlyDuration(value)); + } + if (RAMification) { + console.log(" Current Footprint:", uiFriendlyNumber(this.currentFootprint)); + console.log(" Peak Footprint:", uiFriendlyNumber(this.peakFootprint)); + } + console.log(""); + } + renderScatterPlot() { const plotContainer = document.getElementById(`plot-${this.name}`); if (!plotContainer || !this.results || this.results.length === 0) @@ -1202,24 +1217,6 @@ class Benchmark { } plotContainer.innerHTML = `${circlesSVG}`; } - - updateConsoleAfterRun(scoreEntries, timeEntries) { - for (let [name, value] of scoreEntries) { - console.log( - shellFriendlyLabel(` ${name}`), - shellFriendlyScore(value)); - } - for (let [name, value] of timeEntries) { - console.log( - shellFriendlyLabel(` ${name}-Time`), - shellFriendlyDuration(value)); - } - if (RAMification) { - console.log(" Current Footprint:", uiFriendlyNumber(this.currentFootprint)); - console.log(" Peak Footprint:", uiFriendlyNumber(this.peakFootprint)); - } - console.log(""); - } }; class GroupedBenchmark extends Benchmark { From da7f1272b6491badead028a39378450e40bab8e9 Mon Sep 17 00:00:00 2001 From: Camillo Bruni Date: Wed, 3 Sep 2025 16:24:10 +0200 Subject: [PATCH 08/14] more cleanup --- JetStreamDriver.js | 3 --- 1 file changed, 3 deletions(-) diff --git a/JetStreamDriver.js b/JetStreamDriver.js index a2398d6d..803dbad4 100644 --- a/JetStreamDriver.js +++ b/JetStreamDriver.js @@ -402,9 +402,6 @@ class Driver { text += `

`; } - for (let f = 0; f < 5; f++) - text += `
`; - const timestamp = performance.now(); document.getElementById('jetstreams').style.backgroundImage = `url('jetstreams.svg?${timestamp}')`; const resultsTable = document.getElementById("results"); From 1eada15b8152866bf0fe923eccc2354b9cdbd9b1 Mon Sep 17 00:00:00 2001 From: Camillo Bruni Date: Tue, 23 Sep 2025 11:42:44 +0200 Subject: [PATCH 09/14] update printing --- JetStreamDriver.js | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/JetStreamDriver.js b/JetStreamDriver.js index c3481aa4..810b3afa 100644 --- a/JetStreamDriver.js +++ b/JetStreamDriver.js @@ -126,7 +126,7 @@ function uiFriendlyDuration(time) { function shellFriendlyLabel(label) { - const namePadding = 19; + const namePadding = 30; return `${label}:`.padEnd(namePadding); } @@ -136,7 +136,7 @@ function shellFriendlyDuration(time) { } function shellFriendlyScore(time) { - return `${uiFriendlyScore(time)} `.padStart(valuePadding); + return `${uiFriendlyScore(time)} # `.padStart(valuePadding); } @@ -228,7 +228,7 @@ class Driver { if (isInBrowser) document.getElementById("benchmark-total-time-score").innerHTML = uiFriendlyNumber(totalTime); else if (!JetStreamParams.dumpJSONResults) - console.log("Total time:", uiFriendlyNumber(totalTime)); + console.log("Total-Time:", uiFriendlyNumber(totalTime)); allScores.push(totalTime); } @@ -300,8 +300,8 @@ class Driver { shellFriendlyDuration(geomeanScore(times))); } console.log(""); - console.log(shellFriendlyLabel("Total Score:"), shellFriendlyScore(totalScore)); - console.log(shellFriendlyLabel("Total Time:"), shellFriendlyDuration(totalTime)); + console.log(shellFriendlyLabel("Total-Score:"), shellFriendlyScore(totalScore)); + console.log(shellFriendlyLabel("Total-Time:"), shellFriendlyDuration(totalTime)); console.log(""); } @@ -1121,22 +1121,24 @@ class Benchmark { updateConsoleAfterRun() { for (let [name, value] of Object.entries(this.allScores())) { - console.log( - shellFriendlyLabel(` ${name}`), - shellFriendlyScore(value)); + this.logMetric(name, shellFriendlyScore(value)); } for (let [name, value] of Object.entries(this.allTimes())) { - console.log( - shellFriendlyLabel(` ${name}-Time`), - shellFriendlyDuration(value)); + this.logMetric(`${name}-Time`, shellFriendlyDuration(value)); } if (JetStreamParams.RAMification) { - console.log(" Current Footprint:", uiFriendlyNumber(this.currentFootprint)); - console.log(" Peak Footprint:", uiFriendlyNumber(this.peakFootprint)); + this.logMetric("Current Footprint", uiFriendlyNumber(this.currentFootprint)); + this.logMetric("Peak Footprint", uiFriendlyNumber(this.peakFootprint)); } console.log(""); } + logMetric(name, value) { + console.log( + shellFriendlyLabel(`${this.name} ${name}`), + value); + } + renderScatterPlot() { const plotContainer = document.getElementById(`plot-${this.name}`); if (!plotContainer || !this.results || this.results.length === 0) From 0829c4f4e432df9406220cd1762ae585e1bb4bb4 Mon Sep 17 00:00:00 2001 From: Camillo Bruni Date: Tue, 23 Sep 2025 12:07:38 +0200 Subject: [PATCH 10/14] fixes --- JetStreamDriver.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/JetStreamDriver.js b/JetStreamDriver.js index 564b9a4d..a4453f10 100644 --- a/JetStreamDriver.js +++ b/JetStreamDriver.js @@ -126,7 +126,7 @@ function uiFriendlyDuration(time) { function shellFriendlyLabel(label) { - const namePadding = 30; + const namePadding = 40; return `${label}:`.padEnd(namePadding); } @@ -1315,11 +1315,14 @@ class DefaultBenchmark extends Benchmark { } subTimes() { - return { + const times = { "First": this.firstIterationTime, - "Worst": this.worstTime, - "Average": this.averageTime, }; + if (this.worstCaseCount) + times["Worst"] = this.worstTime; + if (this.iterations > 1) + times["Average"] = this.averageTime; + return times; } } From 846ffe58e2978073d64fcbdbcf34a33c8e80b32c Mon Sep 17 00:00:00 2001 From: Camillo Bruni Date: Tue, 23 Sep 2025 15:51:18 +0200 Subject: [PATCH 11/14] better names --- JetStreamDriver.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/JetStreamDriver.js b/JetStreamDriver.js index a4453f10..82296803 100644 --- a/JetStreamDriver.js +++ b/JetStreamDriver.js @@ -289,19 +289,20 @@ class Driver { statusElement.innerHTML = ""; } else if (!JetStreamParams.dumpJSONResults) { console.log(""); + console.log("Total:"); for (let [category, scores] of categoryScores) { console.log( - shellFriendlyLabel(category), + shellFriendlyLabel(`${category}-Score`), shellFriendlyScore(geomeanScore(scores))); } for (let [category, times] of categoryTimes) { console.log( - shellFriendlyLabel(`${category}-Time:`), + shellFriendlyLabel(`${category}-Time`), shellFriendlyDuration(geomeanScore(times))); } console.log(""); - console.log(shellFriendlyLabel("Total-Score:"), shellFriendlyScore(totalScore)); - console.log(shellFriendlyLabel("Total-Time:"), shellFriendlyDuration(totalTime)); + console.log(shellFriendlyLabel("Total-Score"), shellFriendlyScore(totalScore)); + console.log(shellFriendlyLabel("Total-Time"), shellFriendlyDuration(totalTime)); console.log(""); } From 7247e7d121a179ead9fd25b8701b4e0917c75a28 Mon Sep 17 00:00:00 2001 From: Camillo Bruni Date: Tue, 23 Sep 2025 15:51:40 +0200 Subject: [PATCH 12/14] compact --- JetStreamDriver.js | 1 - 1 file changed, 1 deletion(-) diff --git a/JetStreamDriver.js b/JetStreamDriver.js index 82296803..937d173f 100644 --- a/JetStreamDriver.js +++ b/JetStreamDriver.js @@ -288,7 +288,6 @@ class Driver { summaryElement.onclick = displayCategoryScores; statusElement.innerHTML = ""; } else if (!JetStreamParams.dumpJSONResults) { - console.log(""); console.log("Total:"); for (let [category, scores] of categoryScores) { console.log( From 16a5bacb09ffc37bc7b77c4ec9396411c75852a8 Mon Sep 17 00:00:00 2001 From: Camillo Bruni Date: Tue, 23 Sep 2025 16:26:56 +0200 Subject: [PATCH 13/14] further fixes --- JetStreamDriver.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/JetStreamDriver.js b/JetStreamDriver.js index 937d173f..26f500a2 100644 --- a/JetStreamDriver.js +++ b/JetStreamDriver.js @@ -1121,6 +1121,9 @@ class Benchmark { updateConsoleAfterRun() { for (let [name, value] of Object.entries(this.allScores())) { + if (!name.endsWith("Score")) + name = `${name}-Score`; + this.logMetric(name, shellFriendlyScore(value)); } for (let [name, value] of Object.entries(this.allTimes())) { From 5f607d87ad73301349a17d279fd30c0d1b66117d Mon Sep 17 00:00:00 2001 From: Camillo Bruni Date: Tue, 21 Oct 2025 10:26:01 +0200 Subject: [PATCH 14/14] address comments --- JetStreamDriver.js | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/JetStreamDriver.js b/JetStreamDriver.js index c941e824..e6105f0b 100644 --- a/JetStreamDriver.js +++ b/JetStreamDriver.js @@ -134,19 +134,18 @@ function uiFriendlyDuration(time) { return `${time.toFixed(2)} ms`; } - +const LABEL_PADDING = 45; function shellFriendlyLabel(label) { - const namePadding = 40; - return `${label}:`.padEnd(namePadding); + return `${label}`.padEnd(LABEL_PADDING); } -const valuePadding = 10; +const VALUE_PADDING = 11; function shellFriendlyDuration(time) { - return `${uiFriendlyDuration(time)}`.padStart(valuePadding); + return `${uiFriendlyDuration(time)} `.padStart(VALUE_PADDING); } function shellFriendlyScore(time) { - return `${uiFriendlyScore(time)} # `.padStart(valuePadding); + return `${uiFriendlyScore(time)} pts`.padStart(VALUE_PADDING); }