Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

benchmark: update iteration and size in benchmark/crypto/randomBytes.js #50868

Merged
merged 3 commits into from
Dec 9, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions benchmark/crypto/randomBytes.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 }) {
H4ad marked this conversation as resolved.
Show resolved Hide resolved
bench.start();
for (let i = 0; i < n; ++i)
randomBytes(size);
_cryptoResult = randomBytes(size);
bench.end(n);
// Avoid V8 deadcode (elimination)
assert.ok(_cryptoResult);
}