From 52bda74bb5c122233f870a9df7de9317beb00fba Mon Sep 17 00:00:00 2001 From: Chris Duncan Date: Sat, 25 Jul 2026 22:21:37 -0700 Subject: [PATCH] Debug always. Adjust info content. --- index.html | 43 +++++++++++++++++++------------------------ 1 file changed, 19 insertions(+), 24 deletions(-) diff --git a/index.html b/index.html index 4a2c261..c520cac 100644 --- a/index.html +++ b/index.html @@ -62,15 +62,15 @@ SPDX-License-Identifier: GPL-3.0-or-later * @param {string} api * @param {string} difficulty * @param {number} effort - * @param {boolean }debug */ - async function sequenceGenerateValidate (api, difficulty, effort, debug) { - let start = 0, end = 0, duration = 0, result = null, check = false + async function sequenceGenerateValidate (api, difficulty, effort) { + let start = end = duration = 0, result = null, check = false + const options = { api, difficulty, effort, debug: true } const hash = random() start = performance.now() - result = await NanoPow.work_generate(hash, {api, debug, difficulty, effort}) - check = await NanoPow.work_validate(result.work, result.hash, {api, debug, difficulty, effort}) + result = await NanoPow.work_generate(hash, options) + check = await NanoPow.work_validate(result.work, result.hash, options) end = performance.now() duration = end - start @@ -99,12 +99,11 @@ SPDX-License-Identifier: GPL-3.0-or-later /** * @param {string} api - * @param {boolean} debug */ - async function selfCheck (api, debug) { + async function selfCheck (api) { document.getElementById('status').innerHTML = `RUNNING SELF-CHECK` logger.log(`%cNanoPow`, 'color:green', 'Checking validation against known values') - const options = { api, debug } + const options = { api, debug: true } // Generate once on load to compile shaders and initialize buffers await NanoPow.work_generate(random(), { ...options, difficulty: '0' }) @@ -204,15 +203,14 @@ SPDX-License-Identifier: GPL-3.0-or-later * @param {string} api * @param {string} difficulty * @param {number} effort - * @param {boolean} debug * @param {number} size * @param {number} runs */ - async function test (api, difficulty, effort, debug, size, runs) { - logger.isEnabled = debug + async function test (api, difficulty, effort, size, runs) { + logger.isEnabled = true const type = api api = type.toLowerCase() - await selfCheck(api, debug) + await selfCheck(api) Cache.clear() logger.log(`%cNanoPow ${type}`, 'color:green', `Calculate truncated harmonic mean of the truncated arithmetic rate of generating proof-of-work across ${runs} runs of ${size} samples.`) const rates = [] @@ -222,7 +220,7 @@ SPDX-License-Identifier: GPL-3.0-or-later for (let j = 0; j < size; j++) { document.getElementById('status').innerHTML = `TESTING IN PROGRESS. THIS MAY TAKE A LONG TIME. ${i}/${runs} ${j}/${size}
` try { - const duration = await sequenceGenerateValidate(api, difficulty, effort, debug) + const duration = await sequenceGenerateValidate(api, difficulty, effort) times.push(duration) } catch (err) { document.getElementById('output').innerHTML += `Error: ${err.message}
` @@ -284,10 +282,9 @@ SPDX-License-Identifier: GPL-3.0-or-later const api = document.getElementById('api') const difficulty = document.getElementById('difficulty') const effort = document.getElementById('effort') - const debug = document.getElementById('debug') const size = document.getElementById('size') const runs = document.getElementById('runs') - test(api.value, difficulty.value, +effort.value, debug.checked, +size.value, +runs.value) + test(api.value, difficulty.value, +effort.value, +size.value, +runs.value) .then(() => { event.target.disabled = false }) @@ -313,21 +310,21 @@ SPDX-License-Identifier: GPL-3.0-or-later

Speed test for nano-pow

https://www.npmjs.com/package/nano-pow

-

This benchmark tests a browser-based proof-of-work implementation for the cryptocurrency Nano. A random 32-byte value is generated for a block hash, and then the test uses this value to find a nonce that meets a minimum threshold.

-

NanoPow uses cutting edge WebGPU technology, and not all browsers support it.

-

NanoPow uses WebGL 2.0 as a fallback option if WebGPU is not detected. It uses a WASM module if neither GPU API is available.

-

Times below are in milliseconds and are summarized by various averaging methods.

+

This benchmark tests a browser-based proof-of-work implementation for the cryptocurrency Nano.

+

NanoPow uses cutting edge WebGPU technology, and not all browsers support it. WebGL 2.0 is used as a fallback option if WebGPU is not detected, and a WASM module is used if neither GPU API is available.

+

Times are measured in milliseconds and are summarized by various averaging methods.

Level of Effort depends on hardware and does not guarantee faster results.

+

This benchmark operates by running a sequence of functions. First, a random 32-byte value is generated for a block hash. Next, the benchmark timer begins and NanoPow uses the block hash to find a nonce that meets a minimum threshold. Finally, it validates that nonce and then ends the timer.

The final score is displayed as "work-per-second" and is calculated as follows:

  1. For each test run:
      -
    1. Collect all the work_generate timings for the test run.
    2. +
    3. Collect all the generate-validate sequence timings for the test run.
    4. Truncate the results by eliminating the fastest 10% and slowest 10% of sequence timings.
    5. Calculate the arithmetic mean (average) of the truncated results.
    @@ -358,8 +355,6 @@ SPDX-License-Identifier: GPL-3.0-or-later
    - - -- 2.52.0