]> zoso.dev Git - libnemo.git/commitdiff
Move test function and reduce record count.
authorChris Duncan <chris@zoso.dev>
Tue, 10 Dec 2024 22:07:25 +0000 (14:07 -0800)
committerChris Duncan <chris@zoso.dev>
Tue, 10 Dec 2024 22:07:25 +0000 (14:07 -0800)
perf/account.perf.js

index 32a0d0e3a834ba2395320e3d2d9d916b2326a30b..0d7deef2f1f7c7f159a25e80d532abc2e9a966a9 100644 (file)
@@ -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)