Skip to content

Commit 278c990

Browse files
Lei Shirichardlau
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 8ee30ea commit 278c990

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

‎benchmark/crypto/randomBytes.js‎

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

6+
// Add together with imports
7+
constassert=require('assert');
8+
9+
let_cryptoResult;
10+
611
constbench=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
functionmain({ n, size }){
1217
bench.start();
1318
for(leti=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)