Skip to content

Commit

Permalink
benchmark: remove buffer benchmarks redundancy
Browse files Browse the repository at this point in the history
PR-URL: #45735
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: Daeyeon Jeong <daeyeon.dev@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
  • Loading branch information
mscdex authored and juanarbol committed Mar 5, 2023
1 parent 6468f30 commit d0b9be2
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 2 deletions.
6 changes: 6 additions & 0 deletions benchmark/buffers/buffer-copy.js
Expand Up @@ -5,6 +5,12 @@ const bench = common.createBenchmark(main, {
bytes: [0, 8, 128, 32 * 1024],
partial: ['true', 'false'],
n: [6e6]
}, {
combinationFilter: (p) => {
return (p.partial === 'false' && p.bytes === 0) ||
(p.partial !== 'false' && p.bytes !== 0);
},
test: { partial: 'false', bytes: 0 },
});

function main({ n, bytes, partial }) {
Expand Down
7 changes: 6 additions & 1 deletion benchmark/buffers/buffer-indexof.js
Expand Up @@ -19,9 +19,14 @@ const searchStrings = [

const bench = common.createBenchmark(main, {
search: searchStrings,
encoding: ['utf8', 'ucs2'],
encoding: ['undefined', 'utf8', 'ucs2'],
type: ['buffer', 'string'],
n: [5e4]
}, {
combinationFilter: (p) => {
return (p.type === 'buffer' && p.encoding === 'undefined') ||
(p.type !== 'buffer' && p.encoding !== 'undefined');
},
});

function main({ n, search, encoding, type }) {
Expand Down
7 changes: 6 additions & 1 deletion benchmark/buffers/buffer-tostring.js
Expand Up @@ -3,10 +3,15 @@
const common = require('../common.js');

const bench = common.createBenchmark(main, {
encoding: ['utf8', 'ascii', 'latin1', 'hex', 'UCS-2'],
encoding: ['', 'utf8', 'ascii', 'latin1', 'hex', 'UCS-2'],
args: [0, 1, 3],
len: [1, 64, 1024],
n: [1e6]
}, {
combinationFilter: (p) => {
return (p.args === 0 && p.encoding === '') ||
(p.args !== 0 && p.encoding !== '');
},
});

function main({ encoding, args, len, n }) {
Expand Down

0 comments on commit d0b9be2

Please sign in to comment.