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

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

const bench = common.createBenchmark(main, {
  size: [64, 1024, 8192, 512 * 1024],
  n: [1e3],
});

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