benchmark: skip running some assert benchmarks by default

These benchmarks are not frequently needed and just slow down the
default benchmark suite. They are kept for users who want to run
them but deactivated by default.

PR-URL: https://github.com/nodejs/node/pull/57370
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
Reviewed-By: Vinícius Lourenço Claro Cardoso <contact@viniciusl.com.br>
This commit is contained in:
Ruben Bridgewater 2025-03-08 15:30:53 +01:00 committed by Node.js GitHub Bot
parent de0bd77328
commit 096b61131a
5 changed files with 30 additions and 4 deletions

View file

@ -4,8 +4,15 @@ const common = require('../common.js');
const assert = require('assert');
const bench = common.createBenchmark(main, {
n: [25, 2e7],
n: [2e7],
method: ['match', 'doesNotMatch'],
}, {
combinationFilter(p) {
// These benchmarks purposefully do not run by default. They do not provide
// might insight, due to only being a small wrapper around a native regexp
// call.
return p.n === 1;
},
});
function main({ n, method }) {

View file

@ -4,8 +4,15 @@ const common = require('../common.js');
const assert = require('assert');
const bench = common.createBenchmark(main, {
n: [25, 2e5],
n: [2e5],
method: ['rejects', 'doesNotReject'],
}, {
combinationFilter(p) {
// These benchmarks purposefully do not run by default. They do not provide
// much insight, due to only being a small wrapper around a native promise
// with a few extra checks.
return p.n === 1;
},
});
async function main({ n, method }) {

View file

@ -4,9 +4,15 @@ const common = require('../common.js');
const assert = require('assert');
const bench = common.createBenchmark(main, {
n: [25, 2e5],
n: [2e5],
type: ['string', 'object', 'number'],
method: ['strictEqual', 'notStrictEqual'],
}, {
combinationFilter(p) {
// These benchmarks purposefully do not run by default. They do not provide
// much insight, due to only being a small wrapper around `Object.is()`.
return p.n === 1;
},
});
function main({ type, n, method }) {

View file

@ -4,8 +4,14 @@ const common = require('../common.js');
const assert = require('assert');
const bench = common.createBenchmark(main, {
n: [25, 2e5],
n: [2e5],
method: ['throws', 'doesNotThrow'],
}, {
combinationFilter(p) {
// These benchmarks purposefully do not run by default. They do not provide
// much insight, due to only being a small wrapper around a try / catch.
return p.n === 1;
},
});
function main({ n, method }) {