Skip to content

Commit 863a416

Browse files
mscdexnodejs-github-bot
authored andcommitted
benchmark: remove buffer benchmarks redundancy
PR-URL: #45735 Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Yagiz Nizipli <[email protected]> Reviewed-By: Daeyeon Jeong <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: Rafael Gonzaga <[email protected]>
1 parent 1a8d340 commit 863a416

File tree

3 files changed

+18
-2
lines changed

3 files changed

+18
-2
lines changed

benchmark/buffers/buffer-copy.js

+6
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@ const bench = common.createBenchmark(main, {
55
bytes: [0, 8, 128, 32 * 1024],
66
partial: ['true', 'false'],
77
n: [6e6]
8+
}, {
9+
combinationFilter: (p) => {
10+
return (p.partial === 'false' && p.bytes === 0) ||
11+
(p.partial !== 'false' && p.bytes !== 0);
12+
},
13+
test: { partial: 'false', bytes: 0 },
814
});
915

1016
function main({ n, bytes, partial }) {

benchmark/buffers/buffer-indexof.js

+6-1
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,14 @@ const searchStrings = [
1919

2020
const bench = common.createBenchmark(main, {
2121
search: searchStrings,
22-
encoding: ['utf8', 'ucs2'],
22+
encoding: ['undefined', 'utf8', 'ucs2'],
2323
type: ['buffer', 'string'],
2424
n: [5e4]
25+
}, {
26+
combinationFilter: (p) => {
27+
return (p.type === 'buffer' && p.encoding === 'undefined') ||
28+
(p.type !== 'buffer' && p.encoding !== 'undefined');
29+
},
2530
});
2631

2732
function main({ n, search, encoding, type }) {

benchmark/buffers/buffer-tostring.js

+6-1
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,15 @@
33
const common = require('../common.js');
44

55
const bench = common.createBenchmark(main, {
6-
encoding: ['utf8', 'ascii', 'latin1', 'hex', 'UCS-2'],
6+
encoding: ['', 'utf8', 'ascii', 'latin1', 'hex', 'UCS-2'],
77
args: [0, 1, 3],
88
len: [1, 64, 1024],
99
n: [1e6]
10+
}, {
11+
combinationFilter: (p) => {
12+
return (p.args === 0 && p.encoding === '') ||
13+
(p.args !== 0 && p.encoding !== '');
14+
},
1015
});
1116

1217
function main({ encoding, args, len, n }) {

0 commit comments

Comments
 (0)