1 const uuidv1
= require('uuid/v1')
2 const uuidv4
= require('uuid/v4')
3 const uuidv5
= require('uuid/v5')
4 const Benchmark
= require('benchmark')
5 const suite
= new Benchmark
.Suite()
6 const MY_NAMESPACE
= '1b671a64-40d5-491e-99b0-da01ff1f3341'
9 suite
.add('uuid v4', function () {
12 .add('uuid v5', function () {
13 uuidv5('Hello, World!', MY_NAMESPACE
)
15 .add('uuid v1', async
function () {
19 .on('cycle', function (event
) {
20 console
.log(String(event
.target
))
22 .on('complete', function () {
23 this.filter('fastest').map('name')
24 console
.log('Fastest is ' + this.filter('fastest').map('name'))