Skip to content

Commit 7592cf4

Browse files
BridgeARaduh95
authored andcommitted
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: #57370 Reviewed-By: Rafael Gonzaga <[email protected]> Reviewed-By: Vinícius Lourenço Claro Cardoso <[email protected]>
1 parent e4cc54a commit 7592cf4

File tree

5 files changed

+30
-4
lines changed

5 files changed

+30
-4
lines changed

benchmark/assert/match.js

+8-1
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,15 @@ const common = require('../common.js');
44
const assert = require('assert');
55

66
const bench = common.createBenchmark(main, {
7-
n: [25, 2e7],
7+
n: [2e7],
88
method: ['match', 'doesNotMatch'],
9+
}, {
10+
combinationFilter(p) {
11+
// These benchmarks purposefully do not run by default. They do not provide
12+
// might insight, due to only being a small wrapper around a native regexp
13+
// call.
14+
return p.n === 1;
15+
},
916
});
1017

1118
function main({ n, method }) {

benchmark/assert/rejects.js

+8-1
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,15 @@ const common = require('../common.js');
44
const assert = require('assert');
55

66
const bench = common.createBenchmark(main, {
7-
n: [25, 2e5],
7+
n: [2e5],
88
method: ['rejects', 'doesNotReject'],
9+
}, {
10+
combinationFilter(p) {
11+
// These benchmarks purposefully do not run by default. They do not provide
12+
// much insight, due to only being a small wrapper around a native promise
13+
// with a few extra checks.
14+
return p.n === 1;
15+
},
916
});
1017

1118
async function main({ n, method }) {

benchmark/assert/strictequal.js

+7-1
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,15 @@ const common = require('../common.js');
44
const assert = require('assert');
55

66
const bench = common.createBenchmark(main, {
7-
n: [25, 2e5],
7+
n: [2e5],
88
type: ['string', 'object', 'number'],
99
method: ['strictEqual', 'notStrictEqual'],
10+
}, {
11+
combinationFilter(p) {
12+
// These benchmarks purposefully do not run by default. They do not provide
13+
// much insight, due to only being a small wrapper around `Object.is()`.
14+
return p.n === 1;
15+
},
1016
});
1117

1218
function main({ type, n, method }) {

benchmark/assert/throws.js

+7-1
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,14 @@ const common = require('../common.js');
44
const assert = require('assert');
55

66
const bench = common.createBenchmark(main, {
7-
n: [25, 2e5],
7+
n: [2e5],
88
method: ['throws', 'doesNotThrow'],
9+
}, {
10+
combinationFilter(p) {
11+
// These benchmarks purposefully do not run by default. They do not provide
12+
// much insight, due to only being a small wrapper around a try / catch.
13+
return p.n === 1;
14+
},
915
});
1016

1117
function main({ n, method }) {

0 commit comments

Comments
 (0)