Skip to content
Closed
Show file tree
Hide file tree
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
9 changes: 4 additions & 5 deletions benchmark/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand All @@ -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}`);
}
Expand Down
3 changes: 1 addition & 2 deletions benchmark/crypto/randomUUID.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 });
Expand Down
4 changes: 2 additions & 2 deletions benchmark/util/deprecate.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'],
Expand All @@ -23,7 +23,7 @@ function main({ n, modifyPrototype, emitWarningSync }) {
'This function is deprecated',
'DEP0000',
emitWarningSync,
!!modifyPrototype,
modifyPrototype,
);

let sum = 0;
Expand Down
Loading