refactor: remove home made random integer generator
[benchmarks-js.git] / uuid-generator.mjs
CommitLineData
f45b29bf 1import { randomUUID } from 'node:crypto'
f522d7b9
JB
2import Benchmark from 'benny'
3import { v4 as uuid } from 'uuid'
5ae4976a
JB
4
5Benchmark.suite(
6 'UUIDv4 generator',
7 Benchmark.add('crypto randomUUID', () => {
f45b29bf 8 randomUUID()
5ae4976a
JB
9 }),
10 Benchmark.add('uuid', () => {
5ae4976a
JB
11 uuid()
12 }),
13 Benchmark.cycle(),
14 Benchmark.complete(),
15 Benchmark.save({
16 file: 'uuid-generator',
17 format: 'json',
18 details: true
19 }),
20 Benchmark.save({
21 file: 'uuid-generator',
22 format: 'chart.html',
23 details: true
24 }),
25 Benchmark.save({
26 file: 'uuid-generator',
27 format: 'table.html',
28 details: true
29 })
4aa2893a 30).catch(console.error)