From 82c65c1a9a2386f11f9280f88ce1fc0e97e94b23 Mon Sep 17 00:00:00 2001 From: Chris Duncan Date: Thu, 30 Apr 2026 22:12:33 -0700 Subject: [PATCH] Scrap performance tests as outdated. --- test/main.perf.mjs | 8 ----- test/perf.account.mjs | 74 ------------------------------------------- test/perf.block.mjs | 28 ---------------- test/perf.wallet.mjs | 38 ---------------------- 4 files changed, 148 deletions(-) delete mode 100644 test/main.perf.mjs delete mode 100644 test/perf.account.mjs delete mode 100644 test/perf.block.mjs delete mode 100644 test/perf.wallet.mjs diff --git a/test/main.perf.mjs b/test/main.perf.mjs deleted file mode 100644 index 27c2439..0000000 --- a/test/main.perf.mjs +++ /dev/null @@ -1,8 +0,0 @@ -//! SPDX-FileCopyrightText: 2025 Chris Duncan -//! SPDX-License-Identifier: GPL-3.0-or-later - -import './perf.wallet.mjs' -import './perf.account.mjs' -import './perf.block.mjs' - -console.log('%cTESTING COMPLETE', 'color:orange;font-weight:bold') diff --git a/test/perf.account.mjs b/test/perf.account.mjs deleted file mode 100644 index 82500a3..0000000 --- a/test/perf.account.mjs +++ /dev/null @@ -1,74 +0,0 @@ -//! SPDX-FileCopyrightText: 2025 Chris Duncan -//! SPDX-License-Identifier: GPL-3.0-or-later - -'use strict' - -import { Wallet } from 'libnemo' -import { assert, stats, suite, test } from './GLOBALS.mjs' -import { NANO_TEST_VECTORS } from './VECTORS.mjs' - -await Promise.all([ - suite('Account performance', { skip: true }, async () => { - const COUNT = 0x200 - - await test(`Time to create ${COUNT} BIP-44 accounts`, async () => { - const wallet = await Wallet.create('BIP-44', NANO_TEST_VECTORS.PASSWORD) - await wallet.unlock(NANO_TEST_VECTORS.PASSWORD) - - const start = performance.now() - const accounts = await wallet.accounts(0, COUNT - 1) - const end = performance.now() - console.log(`Total: ${end - start} ms`) - console.log(`Average: ${(end - start) / COUNT} ms`) - assert.equal(accounts.size, COUNT) - - await wallet.destroy() - }) - - await test(`Time to create ${COUNT} BLAKE2b accounts`, async () => { - const wallet = await Wallet.create('BLAKE2b', NANO_TEST_VECTORS.PASSWORD) - await wallet.unlock(NANO_TEST_VECTORS.PASSWORD) - - const start = performance.now() - const accounts = await wallet.accounts(0, COUNT - 1) - const end = performance.now() - console.log(`Total: ${end - start} ms`) - console.log(`Average: ${(end - start) / COUNT} ms`) - assert.equal(accounts.size, COUNT) - - await wallet.destroy() - }) - - await test(`Time to create 1 BIP-44 account ${COUNT} times`, async () => { - const wallet = await Wallet.create('BIP-44', NANO_TEST_VECTORS.PASSWORD) - await wallet.unlock(NANO_TEST_VECTORS.PASSWORD) - - const times = [] - for (let i = 0; i < COUNT; i++) { - const start = performance.now() - await wallet.account(i) - const end = performance.now() - times.push(end - start) - } - console.log(stats(times)) - - await wallet.destroy() - }) - - await test(`Time to create 1 BLAKE2b account ${COUNT} times`, async () => { - const wallet = await Wallet.create('BLAKE2b', NANO_TEST_VECTORS.PASSWORD) - await wallet.unlock(NANO_TEST_VECTORS.PASSWORD) - - const times = [] - for (let i = 0; i < COUNT; i++) { - const start = performance.now() - await wallet.account(i) - const end = performance.now() - times.push(end - start) - } - console.log(stats(times)) - - await wallet.destroy() - }) - }) -]) diff --git a/test/perf.block.mjs b/test/perf.block.mjs deleted file mode 100644 index 31f2e6e..0000000 --- a/test/perf.block.mjs +++ /dev/null @@ -1,28 +0,0 @@ -//! SPDX-FileCopyrightText: 2025 Chris Duncan -//! SPDX-License-Identifier: GPL-3.0-or-later - -'use strict' - -import { Block } from 'libnemo' -import { stats, suite, test } from './GLOBALS.mjs' -import { NANO_TEST_VECTORS } from './VECTORS.mjs' - -await Promise.all([ - suite('Block performance', { skip: true }, async () => { - const COUNT = 0x200 - - await test(`sign a send block ${COUNT} times`, async () => { - const { account, balance, key, previous, representative } = NANO_TEST_VECTORS.SEND_BLOCK - const times = [] - const block = new Block(account, balance, previous, representative) - .send(NANO_TEST_VECTORS.SEND_BLOCK.link, 0) - for (let i = 0; i < COUNT; i++) { - const start = performance.now() - await block.sign(key) - const end = performance.now() - times.push(end - start) - } - console.log(stats(times)) - }) - }) -]) diff --git a/test/perf.wallet.mjs b/test/perf.wallet.mjs deleted file mode 100644 index eb6bfec..0000000 --- a/test/perf.wallet.mjs +++ /dev/null @@ -1,38 +0,0 @@ -//! SPDX-FileCopyrightText: 2025 Chris Duncan -//! SPDX-License-Identifier: GPL-3.0-or-later - -'use strict' - -import { Wallet } from 'libnemo' -import { stats, suite, test } from './GLOBALS.mjs' -import { NANO_TEST_VECTORS } from './VECTORS.mjs' - -await Promise.all([ - suite(`Wallet performance`, { skip: true }, async () => { - const COUNT = 0x20 - - await test(`Time to create ${COUNT} BIP-44 wallets`, async () => { - const times = [] - for (let i = 0; i < COUNT; i++) { - const start = performance.now() - const wallet = await Wallet.create('BIP-44', NANO_TEST_VECTORS.PASSWORD) - const end = performance.now() - times.push(end - start) - await wallet.destroy() - } - console.log(stats(times)) - }) - - await test(`Time to create ${COUNT} BLAKE2b wallets`, async () => { - const times = [] - for (let i = 0; i < COUNT; i++) { - const start = performance.now() - const wallet = await Wallet.create('BLAKE2b', NANO_TEST_VECTORS.PASSWORD) - const end = performance.now() - times.push(end - start) - await wallet.destroy() - } - console.log(stats(times)) - }) - }) -]) -- 2.47.3