import { NANO_TEST_VECTORS } from '#test/TEST_VECTORS.js'
import { Bip44Wallet, Blake2bWallet } from '#dist/main.js'
-await test('BIP-44 ckd performance test', async () => {
+await test('total time to create 0x8000 BIP-44 accounts', async () => {
const wallet = await Bip44Wallet.create(NANO_TEST_VECTORS.PASSWORD)
await wallet.unlock(NANO_TEST_VECTORS.PASSWORD)
let now = performance.now()
assert.equals(accounts.length, 0x8000)
})
-await test('BLAKE2b ckd performance test', async () => {
+await test('average time to create 1 BIP-44 account 0x80 times', async () => {
+ const wallet = await Bip44Wallet.create(NANO_TEST_VECTORS.PASSWORD)
+ await wallet.unlock(NANO_TEST_VECTORS.PASSWORD)
+ let now = performance.now()
+ for (let i = 0; i < 0x80; i++) {
+ await wallet.accounts(i)
+ }
+ const avg = (performance.now() - now) / 0x80
+ console.log(`${avg} ms`)
+})
+
+await test('create 0x8000 BLAKE2b accounts', async () => {
const wallet = await Blake2bWallet.create(NANO_TEST_VECTORS.PASSWORD)
await wallet.unlock(NANO_TEST_VECTORS.PASSWORD)
let now = performance.now()
console.log(`${performance.now() - now} ms`)
assert.equals(accounts.length, 0x8000)
})
+
+
+await test('average time to create 1 BLAKE2b account 0x80 times', async () => {
+ const wallet = await Blake2bWallet.create(NANO_TEST_VECTORS.PASSWORD)
+ await wallet.unlock(NANO_TEST_VECTORS.PASSWORD)
+ let now = performance.now()
+ for (let i = 0; i < 0x80; i++) {
+ await wallet.accounts(i)
+ }
+ const avg = (performance.now() - now) / 0x80
+ console.log(`${avg} ms`)
+})