From: Chris Duncan Date: Thu, 16 Jan 2025 19:14:16 +0000 (-0800) Subject: Validate test run after computing work instead of during timer. X-Git-Tag: v2.0.0~36 X-Git-Url: https://zoso.dev/?a=commitdiff_plain;h=afef55681ae8142aa050c8dac24b085cf4134423;p=nano-pow.git Validate test run after computing work instead of during timer. --- diff --git a/test.html b/test.html index bc26e0a..587e004 100644 --- a/test.html +++ b/test.html @@ -93,16 +93,15 @@ SPDX-License-Identifier: GPL-3.0-or-later for (let i = 0; i < size; i++) { const hash = random() let work = null - let isValid = null const start = performance.now() try { work = await NanoPow.search(hash, { effort, debug }) - isValid = (await NanoPow.validate(work, hash)) ? 'VALID' : 'INVALID' } catch (err) { document.getElementById('output').innerHTML += `Error: ${err.message}
` console.error(err) } const end = performance.now() + const isValid = (await NanoPow.validate(work, hash)) ? 'VALID' : 'INVALID' times.push(end - start) const msg = `${isValid} [${work}] ${hash} (${end - start} ms)` // console.log(msg)