]> zoso.dev Git - nano-pow.git/commitdiff
Reduce test count to a more reasonable number for a default run. Add some text to...
authorChris Duncan <chris@zoso.dev>
Sun, 12 Jan 2025 07:50:19 +0000 (23:50 -0800)
committerChris Duncan <chris@zoso.dev>
Sun, 12 Jan 2025 07:50:19 +0000 (23:50 -0800)
src/classes/gpu.ts
test.html

index a2923fdf94e7187f8e444bc235311f4f58ff7028..6da73960fa6a9604149db84f90042df7ff5d4c81 100644 (file)
@@ -138,7 +138,7 @@ export class NanoPowGpu {
        /**
        * Validates that a nonce satisfies Nano proof-of-work requirements.
        *
-       * @param {string} work - Hexadecimal proof-of-work value
+       * @param {string} work - Hexadecimal proof-of-work value to validate
        * @param {string} hash - Hexadecimal hash of previous block, or public key for new accounts
        * @param {number} [threshold=0xfffffff8] - Difficulty of proof-of-work calculation
        */
index ffe3bca2764c46955113845ca648b35aec92f6e9..6dd409f82c4de04e06675435bbd9cfcebf69c70d 100644 (file)
--- a/test.html
+++ b/test.html
@@ -13,7 +13,7 @@ SPDX-License-Identifier: GPL-3.0-or-later
        <script type="module" src="https://cdn.jsdelivr.net/npm/nano-webgl-pow@1.1.1/nano-webgl-pow.js"></script>
        <script type="module">
                const { NanoPowGl, NanoPowGpu } = NanoPow
-               const COUNT = 0xff
+               const COUNT = 0x20
                let times = []
 
                function random (size = 32) {
@@ -67,6 +67,7 @@ SPDX-License-Identifier: GPL-3.0-or-later
 
                console.log(`%cNanoPowGpu `, 'color:green', `Calculate proof-of-work for ${COUNT} unique send block hashes`)
                times = []
+               document.getElementById('output').innerHTML += `Now testing: NanoPowGpu<br/>`
                for (let i = 0; i < COUNT; i++) {
                        const hash = random()
                        let work = null
@@ -91,6 +92,7 @@ SPDX-License-Identifier: GPL-3.0-or-later
 
                console.log(`%cNanoPowGl `, 'color:green', `Calculate proof-of-work for ${COUNT} unique send block hashes`)
                times = []
+               document.getElementById('output').innerHTML += `Now testing: NanoPowGl<br/>`
                for (let i = 0; i < COUNT; i++) {
                        const hash = random()
                        const start = performance.now()
@@ -109,6 +111,7 @@ SPDX-License-Identifier: GPL-3.0-or-later
                window.NanoWebglPow.width = 256 * Math.max(1, Math.floor(navigator.hardwareConcurrency))
                window.NanoWebglPow.height = 256 * Math.max(1, Math.floor(navigator.hardwareConcurrency))
                times = []
+               document.getElementById('output').innerHTML += `Now testing: nano-webgl-pow<br/>`
                for (let i = 0; i < COUNT; i++) {
                        const hash = random()
                        const start = performance.now()