From cc466dd995b4cd292ef11419e2bdee3a8769dc25 Mon Sep 17 00:00:00 2001 From: Lei Shi Date: Mon, 27 Nov 2023 16:23:31 +0800 Subject: [PATCH 1/3] benchmark: update iteration and size in benchmark/crypto/randomBytes.js Fixes: https://github.com/nodejs/node/issues/50571 --- benchmark/crypto/randomBytes.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/benchmark/crypto/randomBytes.js b/benchmark/crypto/randomBytes.js index 50ad3f08387566..9421b0a2b04103 100644 --- a/benchmark/crypto/randomBytes.js +++ b/benchmark/crypto/randomBytes.js @@ -4,8 +4,8 @@ const common = require('../common.js'); const { randomBytes } = require('crypto'); 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 }) { From 00602cc7f310aef3c358d8ed899b907f80f6ccc5 Mon Sep 17 00:00:00 2001 From: Lei Shi Date: Mon, 27 Nov 2023 16:33:37 +0800 Subject: [PATCH 2/3] benchmark: update iteration and size in benchmark/crypto/randomBytes.js Fixes: https://github.com/nodejs/node/issues/50571 --- benchmark/crypto/randomBytes.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/benchmark/crypto/randomBytes.js b/benchmark/crypto/randomBytes.js index 9421b0a2b04103..ca97b7e51084b4 100644 --- a/benchmark/crypto/randomBytes.js +++ b/benchmark/crypto/randomBytes.js @@ -3,6 +3,11 @@ 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, 8 * 1024, 16 * 1024], n: [1e5], @@ -11,6 +16,8 @@ const bench = common.createBenchmark(main, { 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); } From 971746f9030683c87a83d3878a54698ea8667bb9 Mon Sep 17 00:00:00 2001 From: Lei Shi Date: Tue, 5 Dec 2023 10:57:41 +0800 Subject: [PATCH 3/3] Update benchmark/crypto/randomBytes.js MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Vinicius Lourenço <12551007+H4ad@users.noreply.github.com> --- benchmark/crypto/randomBytes.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/benchmark/crypto/randomBytes.js b/benchmark/crypto/randomBytes.js index ca97b7e51084b4..a47080a017d250 100644 --- a/benchmark/crypto/randomBytes.js +++ b/benchmark/crypto/randomBytes.js @@ -3,7 +3,7 @@ const common = require('../common.js'); const { randomBytes } = require('crypto'); -// add together with imports +// Add together with imports const assert = require('assert'); let _cryptoResult;