diff --git a/benchmark/common.js b/benchmark/common.js index bc8695df09d765..8443da40d79e8a 100644 --- a/benchmark/common.js +++ b/benchmark/common.js @@ -118,10 +118,9 @@ class Benchmark { const [, key, value] = match; if (configs[key] !== undefined) { cliOptions[key] ||= []; - cliOptions[key].push( - // Infer the type from the config object and parse accordingly - typeof configs[key][0] === 'number' ? +value : value, - ); + const configType = typeof configs[key][0]; + const configValue = configType === 'number' ? +value : configType === 'boolean' ? value === 'true' : value; + cliOptions[key].push(configValue); } else { extraOptions[key] = value; } @@ -141,7 +140,7 @@ class Benchmark { const values = options[key]; for (const value of values) { - if (typeof value !== 'number' && typeof value !== 'string') { + if (typeof value !== 'number' && typeof value !== 'string' && typeof value !== 'boolean') { throw new TypeError( `configuration "${key}" had type ${typeof value}`); } diff --git a/benchmark/crypto/randomUUID.js b/benchmark/crypto/randomUUID.js index cca05242874738..e03c502998188d 100644 --- a/benchmark/crypto/randomUUID.js +++ b/benchmark/crypto/randomUUID.js @@ -5,11 +5,10 @@ const { randomUUID } = require('crypto'); const bench = common.createBenchmark(main, { n: [1e7], - disableEntropyCache: [0, 1], + disableEntropyCache: [false, true], }); function main({ n, disableEntropyCache }) { - disableEntropyCache = !!disableEntropyCache; bench.start(); for (let i = 0; i < n; ++i) randomUUID({ disableEntropyCache }); diff --git a/benchmark/util/deprecate.js b/benchmark/util/deprecate.js index a94a7606321003..13ddcec8ecda02 100644 --- a/benchmark/util/deprecate.js +++ b/benchmark/util/deprecate.js @@ -5,7 +5,7 @@ const assert = require('assert'); const bench = common.createBenchmark(main, { n: [1e5], - modifyPrototype: [1, 0], + modifyPrototype: [true, false], emitWarningSync: [1, 0], }, { flags: ['--expose-internals'], @@ -23,7 +23,7 @@ function main({ n, modifyPrototype, emitWarningSync }) { 'This function is deprecated', 'DEP0000', emitWarningSync, - !!modifyPrototype, + modifyPrototype, ); let sum = 0;