]> zoso.dev Git - nano-pow.git/commitdiff
Log mapAsync times and remove validation for more accurate comparison testing.
authorChris Duncan <chris@zoso.dev>
Mon, 20 Jan 2025 06:41:23 +0000 (22:41 -0800)
committerChris Duncan <chris@zoso.dev>
Mon, 20 Jan 2025 06:41:23 +0000 (22:41 -0800)
benchmarks.md
src/classes/gpu.ts
test.html

index 69903fa42066f9ebb83f5301a9dcad5fef678f1b..f8aeb9d3c8ccf27b27c8fe08dfc6ae01654a688b 100644 (file)
@@ -5,6 +5,8 @@ SPDX-License-Identifier: GPL-3.0-or-later
 
 Zero threshold benchmark (vectors)
 
+16.0569471600238 average on 512 when logging mapAsync only
+
 {
        "NanoPow (WebGPU) | Effort: 8 | Dispatch: 4194304 | Threads: 268435456": {
                "count": 512,
index 36937bb445062b892270e6f403b6c264c4ade946..e038f5130492c236cfa43850fbd5e3265e6127cc 100644 (file)
@@ -182,8 +182,11 @@ export class NanoPowGpu {
 
                // Read results back to Javascript and then unmap buffer after reading
                let data = null
+               let start
                try {
+                       start = performance.now()
                        await this.#cpuBuffer.mapAsync(GPUMapMode.READ)
+                       console.log(performance.now() - start)
                        await this.#device.queue.onSubmittedWorkDone()
                        data = new DataView(this.#cpuBuffer.getMappedRange().slice(0))
                        this.#cpuBuffer.unmap()
index 10dc52f8cb1db3d1fdbeb06ed14676c612ee04f7..c00e9192fada3a4971f3ace924011316fa5f8037 100644 (file)
--- a/test.html
+++ b/test.html
@@ -96,7 +96,8 @@ SPDX-License-Identifier: GPL-3.0-or-later
                                        console.error(err)
                                }
                                const end = performance.now()
-                               const isValid = (await NanoPow.validate(work, hash, { threshold: 0 })) ? 'VALID' : 'INVALID'
+                               // const isValid = (await NanoPow.validate(work, hash, { threshold: 0 })) ? 'VALID' : 'INVALID'
+                               const isValid = 'Valid'
                                times.push(end - start)
                                const msg = `${isValid} [${work}] ${hash} (${end - start} ms)`
                                // console.log(msg)