benchmark: add trailing commas in benchmark/buffers

PR-URL: https://github.com/nodejs/node/pull/46473
Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Darshan Sen <raisinten@gmail.com>
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
This commit is contained in:
Antoine du Hamel 2023-02-04 19:19:25 +01:00 committed by GitHub
parent 6bbc2fbd67
commit 95434fbf28
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
30 changed files with 38 additions and 40 deletions

View File

@ -9,8 +9,6 @@ rules:
overrides:
- files:
- buffers/*.js
- buffers-fill/*.js
- crypto/*.js
- http/*.js
- http2/*.js

View File

@ -4,7 +4,7 @@ const common = require('../common.js');
const bench = common.createBenchmark(main, {
n: [32],
size: [8 << 20]
size: [8 << 20],
});
function main({ n, size }) {

View File

@ -24,9 +24,9 @@ const common = require('../common.js');
const bench = common.createBenchmark(main, {
len: [64 * 1024 * 1024],
n: [32]
n: [32],
}, {
test: { len: 256 }
test: { len: 256 },
});
function main({ n, len }) {

View File

@ -4,7 +4,7 @@ const common = require('../common');
const bench = common.createBenchmark(main, {
encoding: ['utf8', 'base64', 'buffer'],
len: [2, 16, 256], // x16
n: [4e6]
n: [4e6],
});
// 16 chars each

View File

@ -4,7 +4,7 @@ const common = require('../common.js');
const bench = common.createBenchmark(main, {
size: [16, 512, 4096, 16386],
args: [1, 2, 5],
n: [1e6]
n: [1e6],
});
function main({ n, size, args }) {

View File

@ -4,7 +4,7 @@ const common = require('../common.js');
const bench = common.createBenchmark(main, {
method: ['offset', 'slice'],
size: [16, 512, 4096, 16386],
n: [1e6]
n: [1e6],
});
function compareUsingSlice(b0, b1, len, iter) {

View File

@ -24,7 +24,7 @@ const common = require('../common.js');
const bench = common.createBenchmark(main, {
size: [16, 512, 4096, 16386],
n: [1e6]
n: [1e6],
});
function main({ n, size }) {

View File

@ -3,7 +3,7 @@ const common = require('../common.js');
const bench = common.createBenchmark(main, {
extraSize: [1, 256, 4 * 256],
n: [8e5]
n: [8e5],
});
function main({ n, extraSize }) {

View File

@ -5,7 +5,7 @@ const bench = common.createBenchmark(main, {
pieces: [4, 16],
pieceSize: [1, 16, 256],
withTotalLength: [0, 1],
n: [8e5]
n: [8e5],
});
function main({ n, pieces, pieceSize, withTotalLength }) {

View File

@ -4,7 +4,7 @@ const common = require('../common.js');
const bench = common.createBenchmark(main, {
bytes: [0, 8, 128, 32 * 1024],
partial: ['true', 'false'],
n: [6e6]
n: [6e6],
}, {
combinationFilter: (p) => {
return (p.partial === 'false' && p.bytes === 0) ||

View File

@ -10,7 +10,7 @@ const bench = common.createBenchmark(main, {
'slow-allocUnsafe',
],
len: [10, 1024, 4096, 8192],
n: [6e5]
n: [6e5],
});
function main({ len, n, type }) {

View File

@ -4,7 +4,7 @@ const common = require('../common.js');
const bench = common.createBenchmark(main, {
size: [0, 512, 16386],
difflen: ['true', 'false'],
n: [1e6]
n: [1e6],
});
function main({ n, size, difflen }) {

View File

@ -15,7 +15,7 @@ const bench = common.createBenchmark(main, {
'fill(Buffer.alloc(1), 0)',
],
size: [2 ** 13, 2 ** 16],
n: [2e4]
n: [2e4],
});
function main({ n, type, size }) {

View File

@ -16,7 +16,7 @@ const bench = common.createBenchmark(main, {
'uint16array',
],
len: [100, 2048],
n: [8e5]
n: [8e5],
});
function main({ len, n, source }) {

View File

@ -4,7 +4,7 @@ const common = require('../common.js');
const bench = common.createBenchmark(main, {
len: [64, 1024],
n: [1e6]
n: [1e6],
});
function main({ len, n }) {

View File

@ -5,12 +5,12 @@ const path = require('path');
const bench = common.createBenchmark(main, {
value: ['@'.charCodeAt(0)],
n: [1e6]
n: [1e6],
});
function main({ n, value }) {
const aliceBuffer = fs.readFileSync(
path.resolve(__dirname, '../fixtures/alice.html')
path.resolve(__dirname, '../fixtures/alice.html'),
);
let count = 0;

View File

@ -21,7 +21,7 @@ const bench = common.createBenchmark(main, {
search: searchStrings,
encoding: ['undefined', 'utf8', 'ucs2'],
type: ['buffer', 'string'],
n: [5e4]
n: [5e4],
}, {
combinationFilter: (p) => {
return (p.type === 'buffer' && p.encoding === 'undefined') ||
@ -31,7 +31,7 @@ const bench = common.createBenchmark(main, {
function main({ n, search, encoding, type }) {
let aliceBuffer = fs.readFileSync(
path.resolve(__dirname, '../fixtures/alice.html')
path.resolve(__dirname, '../fixtures/alice.html'),
);
if (encoding === 'undefined') {

View File

@ -7,13 +7,13 @@ const bench = common.createBenchmark(main, {
size: [512, 4096, 16386],
type: ['fast'],
method: ['for', 'forOf', 'iterator'],
n: [1e3]
n: [1e3],
});
const methods = {
'for': benchFor,
'forOf': benchForOf,
'iterator': benchIterator
'iterator': benchIterator,
};
function main({ size, type, method, n }) {

View File

@ -22,9 +22,9 @@ const bench = common.createBenchmark(main, {
'utf8',
'UTF8',
],
n: [1e6]
n: [1e6],
}, {
flags: ['--expose-internals']
flags: ['--expose-internals'],
});
function main({ encoding, n }) {

View File

@ -5,7 +5,7 @@ const bench = common.createBenchmark(main, {
type: ['Double', 'Float'],
endian: ['LE'],
value: ['zero', 'big', 'small', 'inf', 'nan'],
n: [1e6]
n: [1e6],
});
function main({ n, type, endian, value }) {

View File

@ -12,7 +12,7 @@ const bench = common.createBenchmark(main, {
buffer: ['fast'],
type: types,
n: [1e6],
byteLength: [1, 2, 3, 4, 5, 6]
byteLength: [1, 2, 3, 4, 5, 6],
});
function main({ n, buf, type, byteLength }) {

View File

@ -21,7 +21,7 @@ const types = [
const bench = common.createBenchmark(main, {
buffer: ['fast'],
type: types,
n: [1e6]
n: [1e6],
});
function main({ n, buf, type }) {

View File

@ -4,7 +4,7 @@ const SlowBuffer = require('buffer').SlowBuffer;
const bench = common.createBenchmark(main, {
type: ['fast', 'slow', 'subarray'],
n: [1e6]
n: [1e6],
});
const buf = Buffer.allocUnsafe(1024);

View File

@ -6,9 +6,9 @@ const bench = common.createBenchmark(main, {
aligned: ['true', 'false'],
method: ['swap16', 'swap32', 'swap64'/* , 'htons', 'htonl', 'htonll' */],
len: [64, 256, 768, 1024, 2056, 8192],
n: [1e6]
n: [1e6],
}, {
test: { len: 16 }
test: { len: 16 },
});
// The htons and htonl methods below are used to benchmark the

View File

@ -4,7 +4,7 @@ const common = require('../common.js');
const bench = common.createBenchmark(main, {
n: [1e4],
len: [0, 256, 4 * 1024]
len: [0, 256, 4 * 1024],
});
function main({ n, len }) {

View File

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

View File

@ -7,7 +7,7 @@ const bench = common.createBenchmark(main, {
],
args: [ '', 'offset', 'offset+length' ],
len: [2048],
n: [1e6]
n: [1e6],
});
function main({ len, n, encoding, args }) {

View File

@ -29,7 +29,7 @@ const types = [
const bench = common.createBenchmark(main, {
buffer: ['fast'],
type: types,
n: [1e6]
n: [1e6],
});
const INT8 = 0x7f;
@ -60,14 +60,14 @@ const mod = {
writeUIntLE: INT8,
writeUIntBE: INT16,
writeIntLE: INT32,
writeIntBE: INT48
writeIntBE: INT48,
};
const byteLength = {
writeUIntLE: 1,
writeUIntBE: 2,
writeIntLE: 4,
writeIntBE: 6
writeIntBE: 6,
};
function main({ n, buf, type }) {

View File

@ -4,7 +4,7 @@ const common = require('../common.js');
const bench = common.createBenchmark(main, {
n: [1e6],
type: ['buffer', 'string']
type: ['buffer', 'string'],
});
const zeroBuffer = Buffer.alloc(0);

View File

@ -20,7 +20,7 @@ const types = [
const bench = common.createBenchmark(main, {
type: types,
n: [1e6]
n: [1e6],
});
const INT8 = 0x7f;
@ -36,7 +36,7 @@ const mod = {
setInt32: INT32,
setUint8: UINT8,
setUint16: UINT16,
setUint32: UINT32
setUint32: UINT32,
};
function main({ n, type }) {