From: Chris Duncan Date: Sun, 29 Dec 2024 09:24:10 +0000 (-0800) Subject: Remove receive block from performance testing since it will always be slower then... X-Git-Url: https://zoso.dev/?a=commitdiff_plain;h=107bd6ded389bd14cb4a31c40ff2b1063f7a0d95;p=libnemo.git Remove receive block from performance testing since it will always be slower then sends. --- diff --git a/perf/block.perf.js b/perf/block.perf.js index 7793b26..0fa1337 100644 --- a/perf/block.perf.js +++ b/perf/block.perf.js @@ -5,36 +5,12 @@ import { assert, average, skip, suite, test } from '#GLOBALS.mjs' import { NANO_TEST_VECTORS } from '#test/TEST_VECTORS.js' -import { SendBlock, ReceiveBlock } from '#dist/main.js' +import { SendBlock } from '#dist/main.js' import 'nano-webgl-pow' await suite('Block performance', async () => { const COUNT = 0x10 - await test(`Customized PoW: Time to calculate proof-of-work for a receive block ${COUNT} times`, async () => { - const times = [] - const block = new ReceiveBlock( - NANO_TEST_VECTORS.RECEIVE_BLOCK.account, - NANO_TEST_VECTORS.RECEIVE_BLOCK.balance, - NANO_TEST_VECTORS.RECEIVE_BLOCK.link, - '0', - NANO_TEST_VECTORS.RECEIVE_BLOCK.representative, - NANO_TEST_VECTORS.RECEIVE_BLOCK.previous - ) - for (let i = 0; i < COUNT; i++) { - const start = performance.now() - await block.pow() - const end = performance.now() - times.push(end - start) - console.log(`${block.work} (${end - start} ms)`) - } - const { total, arithmetic, harmonic, geometric } = average(times) - console.log(`Total: ${total} ms`) - console.log(`Average: ${arithmetic} ms`) - console.log(`Harmonic: ${harmonic} ms`) - console.log(`Geometric: ${geometric} ms`) - }) - await test(`Customized PoW: Time to calculate proof-of-work for a send block ${COUNT} times`, async () => { const times = [] const block = new SendBlock(