From 7b10cc7a8f8d5a00ff5eae9a6547c0461d2ab57a Mon Sep 17 00:00:00 2001 From: Chris Duncan Date: Fri, 17 Jan 2025 12:00:02 -0800 Subject: [PATCH] Tweak test summary output. --- src/classes/gpu.ts | 1 - test.html | 25 ++++++++++++++----------- 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/src/classes/gpu.ts b/src/classes/gpu.ts index bc7348a..32f251b 100644 --- a/src/classes/gpu.ts +++ b/src/classes/gpu.ts @@ -242,7 +242,6 @@ export class NanoPowGpu { times.push(performance.now() - start) } while (this.#busy) if (debug) { - console.log(`%cNanoPow (WebGPU) | Dispatch: ${effort ** 2} | Threads: ${8 * 8 * (effort ** 2)}`) this.#logAverages(times) } return nonce.toString(16).padStart(16, '0') diff --git a/test.html b/test.html index 0e28576..a869d42 100644 --- a/test.html +++ b/test.html @@ -28,7 +28,7 @@ SPDX-License-Identifier: GPL-3.0-or-later return hex } - function average (times) { + function average (times, effort) { let count = times.length, sum = 0, reciprocals = 0, logarithms = 0, truncated = 0, min = 0xffff, max = 0, rate = 0 times.sort() for (let i = 0; i < count; i++) { @@ -39,16 +39,19 @@ SPDX-License-Identifier: GPL-3.0-or-later max = Math.max(max, times[i]) if (count < 3 || (i > (count * 0.1) && i < (count * 0.9))) truncated += times[i] } + const title = `NanoPow (WebGPU) | Dispatch: ${(0x100 * effort) ** 2} | Threads: ${8 * 8 * (0x100 * effort) ** 2}` return { - count: count, - total: sum, - rate: 1000 * count / (truncated || sum), - min: min, - max: max, - arithmetic: sum / count, - truncated: truncated / count, - harmonic: count / reciprocals, - geometric: Math.exp(logarithms / count) + [title]: { + count: count, + total: sum, + rate: 1000 * count / (truncated || sum), + min: min, + max: max, + arithmetic: sum / count, + truncated: truncated / count, + harmonic: count / reciprocals, + geometric: Math.exp(logarithms / count) + } } } @@ -108,7 +111,7 @@ SPDX-License-Identifier: GPL-3.0-or-later if (isOutputShown) document.getElementById('output').innerHTML += `${msg}
` } document.getElementById('output').innerHTML += `
` - document.getElementById('summary').innerHTML += `${JSON.stringify(average(times), null, '\t')}
` + document.getElementById('summary').innerHTML += `${JSON.stringify(average(times, effort), null, '\t')}
` print(times) document.getElementById('status').innerHTML = `TESTING COMPLETE
` console.log('%cTESTING COMPLETE', 'color:orange;font-weight:bold') -- 2.34.1