Skip to content

Commit a9baeb3

Browse files
committed
Add benchmark
1 parent ef36cf2 commit a9baeb3

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

test/key-tree.bench.ts

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
import { describe, bench } from 'vitest';
2+
3+
import fixtures from './fixtures';
4+
import { secp256k1, SLIP10Node } from '../src';
5+
import { deriveChildKey } from '../src/derivers/bip39';
6+
7+
describe('SLIP10Node', async () => {
8+
const privateNode = await deriveChildKey({
9+
path: fixtures.local.seed,
10+
curve: secp256k1,
11+
});
12+
13+
const publicNode = privateNode.neuter();
14+
15+
describe('fromExtendedKey', () => {
16+
describe('from a JSON object', () => {
17+
bench('with a private key', async () => {
18+
await SLIP10Node.fromExtendedKey(privateNode.toJSON());
19+
});
20+
21+
bench('with a public key', async () => {
22+
await SLIP10Node.fromExtendedKey(publicNode.toJSON());
23+
});
24+
});
25+
26+
describe('from an extended key', () => {
27+
bench('with a private key', async () => {
28+
await SLIP10Node.fromExtendedKey(privateNode.extendedKey);
29+
});
30+
31+
bench('with a public key', async () => {
32+
await SLIP10Node.fromExtendedKey(publicNode.extendedKey);
33+
});
34+
});
35+
});
36+
});

0 commit comments

Comments
 (0)