mirror of
https://github.com/nodejs/node.git
synced 2025-08-15 13:48:44 +02:00
benchmark: update iteration and size in benchmark/crypto/randomBytes.js
Fixes: https://github.com/nodejs/node/issues/50571 PR-URL: https://github.com/nodejs/node/pull/50868 Reviewed-By: Vinícius Lourenço Claro Cardoso <contact@viniciusl.com.br> Reviewed-By: James M Snell <jasnell@gmail.com>
This commit is contained in:
parent
1ba508d51b
commit
e158b11404
1 changed files with 10 additions and 3 deletions
|
@ -3,14 +3,21 @@
|
|||
const common = require('../common.js');
|
||||
const { randomBytes } = require('crypto');
|
||||
|
||||
// Add together with imports
|
||||
const assert = require('assert');
|
||||
|
||||
let _cryptoResult;
|
||||
|
||||
const bench = common.createBenchmark(main, {
|
||||
size: [64, 1024, 8192, 512 * 1024],
|
||||
n: [1e3],
|
||||
size: [64, 1024, 8 * 1024, 16 * 1024],
|
||||
n: [1e5],
|
||||
});
|
||||
|
||||
function main({ n, size }) {
|
||||
bench.start();
|
||||
for (let i = 0; i < n; ++i)
|
||||
randomBytes(size);
|
||||
_cryptoResult = randomBytes(size);
|
||||
bench.end(n);
|
||||
// Avoid V8 deadcode (elimination)
|
||||
assert.ok(_cryptoResult);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue