From 278c990dea4af88864a71206a8b04664f3d9e48e Mon Sep 17 00:00:00 2001 From: Lei Shi Date: Sun, 10 Dec 2023 02:25:04 +0800 Subject: [PATCH] benchmark: update iteration and size in benchmark/crypto/randomBytes.js MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Reviewed-By: James M Snell --- benchmark/crypto/randomBytes.js | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/benchmark/crypto/randomBytes.js b/benchmark/crypto/randomBytes.js index 50ad3f08387566..a47080a017d250 100644 --- a/benchmark/crypto/randomBytes.js +++ b/benchmark/crypto/randomBytes.js @@ -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); }