summaryrefslogtreecommitdiff
path: root/benchmark/crypto/randomUUID.js
blob: cca05242874738e577893725d5393c06dfca4d04 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
'use strict';

const common = require('../common.js');
const { randomUUID } = require('crypto');

const bench = common.createBenchmark(main, {
  n: [1e7],
  disableEntropyCache: [0, 1],
});

function main({ n, disableEntropyCache }) {
  disableEntropyCache = !!disableEntropyCache;
  bench.start();
  for (let i = 0; i < n; ++i)
    randomUUID({ disableEntropyCache });
  bench.end(n);
}