Commit | Line | Data |
---|---|---|
f45b29bf | 1 | import { randomUUID } from 'node:crypto' |
0c01f51c | 2 | |
f522d7b9 JB |
3 | import Benchmark from 'benny' |
4 | import { v4 as uuid } from 'uuid' | |
5ae4976a JB |
5 | |
6 | Benchmark.suite( | |
7 | 'UUIDv4 generator', | |
8 | Benchmark.add('crypto randomUUID', () => { | |
f45b29bf | 9 | randomUUID() |
5ae4976a JB |
10 | }), |
11 | Benchmark.add('uuid', () => { | |
5ae4976a JB |
12 | uuid() |
13 | }), | |
14 | Benchmark.cycle(), | |
15 | Benchmark.complete(), | |
16 | Benchmark.save({ | |
17 | file: 'uuid-generator', | |
18 | format: 'json', | |
19 | details: true | |
20 | }), | |
21 | Benchmark.save({ | |
22 | file: 'uuid-generator', | |
23 | format: 'chart.html', | |
24 | details: true | |
25 | }), | |
26 | Benchmark.save({ | |
27 | file: 'uuid-generator', | |
28 | format: 'table.html', | |
29 | details: true | |
30 | }) | |
4aa2893a | 31 | ).catch(console.error) |