From 6e1eaf6504cfb7f354c2c81a2c19e0a045b02415 Mon Sep 17 00:00:00 2001 From: Chris Duncan Date: Tue, 10 Dec 2024 14:07:25 -0800 Subject: [PATCH] Move test function and reduce record count. --- perf/account.perf.js | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/perf/account.perf.js b/perf/account.perf.js index 32a0d0e..0d7deef 100644 --- a/perf/account.perf.js +++ b/perf/account.perf.js @@ -8,7 +8,7 @@ import { NANO_TEST_VECTORS } from '#test/TEST_VECTORS.js' import { Bip44Wallet, Blake2bWallet } from '#dist/main.js' await suite('Account performance', async () => { - await test('Time to create 0x2000 BIP-44 accounts', async () => { + await test('Time to create 0x200 BIP-44 accounts', async () => { const wallet = await Bip44Wallet.create(NANO_TEST_VECTORS.PASSWORD) await wallet.unlock(NANO_TEST_VECTORS.PASSWORD) const start = performance.now() @@ -19,6 +19,17 @@ await suite('Account performance', async () => { assert.equals(accounts.length, 0x2000) }) + await test('Time to create 0x200 BLAKE2b accounts', async () => { + const wallet = await Blake2bWallet.create(NANO_TEST_VECTORS.PASSWORD) + await wallet.unlock(NANO_TEST_VECTORS.PASSWORD) + const start = performance.now() + const accounts = await wallet.accounts(0, 0x1fff) + const end = performance.now() + console.log(`Total: ${end - start} ms`) + console.log(`Average: ${(end - start) / 0x2000} ms`) + assert.equals(accounts.length, 0x2000) + }) + await test('Time to create 1 BIP-44 account 0x20 times', async () => { const times = [] const wallet = await Bip44Wallet.create(NANO_TEST_VECTORS.PASSWORD) @@ -36,17 +47,6 @@ await suite('Account performance', async () => { console.log(`Geometric: ${geometric} ms`) }) - await test('Time to create 0x2000 BLAKE2b accounts', async () => { - const wallet = await Blake2bWallet.create(NANO_TEST_VECTORS.PASSWORD) - await wallet.unlock(NANO_TEST_VECTORS.PASSWORD) - const start = performance.now() - const accounts = await wallet.accounts(0, 0x1fff) - const end = performance.now() - console.log(`Total: ${end - start} ms`) - console.log(`Average: ${(end - start) / 0x2000} ms`) - assert.equals(accounts.length, 0x2000) - }) - await test('Average time to create 1 BLAKE2b account 0x20 times', async () => { const times = [] const wallet = await Blake2bWallet.create(NANO_TEST_VECTORS.PASSWORD) -- 2.34.1