Skip to content

Commit 53b16c7

Browse files
Lei ShiRafaelGSS
Lei Shi
authored andcommitted
benchmark: update iteration and size in benchmark/crypto/randomBytes.js
Fixes: #50571 PR-URL: #50868 Reviewed-By: Vinícius Lourenço Claro Cardoso <[email protected]> Reviewed-By: James M Snell <[email protected]>
1 parent fd028e1 commit 53b16c7

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

benchmark/crypto/randomBytes.js

+10-3
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,21 @@
33
const common = require('../common.js');
44
const { randomBytes } = require('crypto');
55

6+
// Add together with imports
7+
const assert = require('assert');
8+
9+
let _cryptoResult;
10+
611
const bench = common.createBenchmark(main, {
7-
size: [64, 1024, 8192, 512 * 1024],
8-
n: [1e3],
12+
size: [64, 1024, 8 * 1024, 16 * 1024],
13+
n: [1e5],
914
});
1015

1116
function main({ n, size }) {
1217
bench.start();
1318
for (let i = 0; i < n; ++i)
14-
randomBytes(size);
19+
_cryptoResult = randomBytes(size);
1520
bench.end(n);
21+
// Avoid V8 deadcode (elimination)
22+
assert.ok(_cryptoResult);
1623
}

0 commit comments

Comments
 (0)