From: Chris Duncan Date: Mon, 20 Jan 2025 06:41:23 +0000 (-0800) Subject: Log mapAsync times and remove validation for more accurate comparison testing. X-Git-Tag: v2.0.0~10 X-Git-Url: https://zoso.dev/?a=commitdiff_plain;h=f7b26b5c0d48d8e30a409a39050f98a03e89db87;p=nano-pow.git Log mapAsync times and remove validation for more accurate comparison testing. --- diff --git a/benchmarks.md b/benchmarks.md index 69903fa..f8aeb9d 100644 --- a/benchmarks.md +++ b/benchmarks.md @@ -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, diff --git a/src/classes/gpu.ts b/src/classes/gpu.ts index 36937bb..e038f51 100644 --- a/src/classes/gpu.ts +++ b/src/classes/gpu.ts @@ -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() diff --git a/test.html b/test.html index 10dc52f..c00e919 100644 --- 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)