From 3ef03ad7a1d6d6cc6fbd2d7a26ea900ff1961b69 Mon Sep 17 00:00:00 2001 From: Chris Duncan Date: Sat, 4 Jan 2025 21:55:19 -0800 Subject: [PATCH] Save some benchmarking notes. --- src/lib/workers/benchmarks.md | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 src/lib/workers/benchmarks.md diff --git a/src/lib/workers/benchmarks.md b/src/lib/workers/benchmarks.md new file mode 100644 index 0000000..c6fd372 --- /dev/null +++ b/src/lib/workers/benchmarks.md @@ -0,0 +1,29 @@ +Total: 89756 ms block.perf.js:76:10 +Average: 5609.75 ms block.perf.js:77:10 +Harmonic: 2092.567565254879 ms block.perf.js:78:10 +Geometric: 3612.112662613675 ms block.perf.js:79:10 +PASS Original PoW module: Time to calculate proof-of-work for a send block 16 times + + +Total: 33240 ms block.perf.js:57:10 +Average: 2077.5 ms block.perf.js:58:10 +Harmonic: 1328.5635414262717 ms block.perf.js:59:10 +Geometric: 1663.110986923899 ms block.perf.js:60:10 +PASS Customized PoW: Time to calculate proof-of-work for a send block 16 times + +How much faster? +Total: 56156 ms +Average: 3532 ms +Harmonic: 764 ms +Geometric: 1949 ms + +The proof-of-work equation for Nano cryptocurrency is defined as `blake2b(nonce||blockhash)>=threshold` where blake2b is the hash function configured for an 8-byte output, nonce is a random 8-byte value, || is concatenation, blockhash is a 32-byte value, and threshold is 0xfffffff800000000. + +My code currently finds valid nonces on a gaming GPU without issue but only because the initial search space is so large due to using a workgroup size of 256 and a dispatch of (256, 256, 256), so the probability of finding a nonce in the first pass is extremely high. However, this does not perform well on less powerful hardware like smartphones. Please alter my code to perform the nonce search in `main()` in a loop until a valid nonce is found with the idea that a smaller workgroup size and/or smaller dispatch dimensions can allow weak hardware to nonetheless iterate through nonces to search for a valid one and return it. + + +Total: 680948 ms block.perf.js:56:10 +Average: 1329.9765625 ms block.perf.js:57:10 +Harmonic: 749.6552658409396 ms block.perf.js:58:10 +Geometric: Infinity ms block.perf.js:59:10 +PASS Customized PoW: Time to calculate proof-of-work for a send block 512 times -- 2.34.1