0
0
mirror of https://github.com/nodejs/node.git synced 2024-11-21 13:09:21 +01:00

benchmark: add trailing commas

PR-URL: https://github.com/nodejs/node/pull/46370
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
Reviewed-By: James M Snell <jasnell@gmail.com>
This commit is contained in:
Antoine du Hamel 2023-01-29 20:13:35 +02:00 committed by GitHub
parent 9954052d08
commit ca5f322d32
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
84 changed files with 134 additions and 116 deletions

View File

@ -5,11 +5,29 @@ env:
es6: true
rules:
comma-dangle: [error, {
arrays: always-multiline,
exports: always-multiline,
functions: only-multiline,
imports: always-multiline,
objects: only-multiline,
}]
prefer-arrow-callback: error
overrides:
- files:
- async_hooks/*.js
- buffers/*.js
- buffers-fill/*.js
- crypto/*.js
- fs/*.js
- http/*.js
- http2/*.js
- misc/*.js
- module/*.js
- net/*.js
- path/*.js
- process/*.js
- url/*.js
- util/*.js
rules:
comma-dangle: [error, {
arrays: always-multiline,
exports: always-multiline,
functions: only-multiline,
imports: always-multiline,
objects: only-multiline,
}]

View File

@ -106,7 +106,7 @@ class TestDoubleBenchmarker {
const scheme = options.scheme || 'http';
const env = {
test_url: `${scheme}://127.0.0.1:${options.port}${options.path}`,
...process.env
...process.env,
};
const child = child_process.fork(this.executable,
@ -203,7 +203,7 @@ exports.run = function(options, callback) {
connections: 100,
duration: 5,
benchmarker: exports.default_http_benchmarker,
...options
...options,
};
if (!options.benchmarker) {
callback(new Error('Could not locate required http benchmarker. See ' +

View File

@ -46,7 +46,7 @@ function main({ n, len, method, strict }) {
}
case 'deepEqual_mixed': {
const values = array.map(
(_, i) => [i % 2 ? [`str_${i}`, 1] : `str_${i}`, 123]
(_, i) => [i % 2 ? [`str_${i}`, 1] : `str_${i}`, 123],
);
benchmark(strict ? deepStrictEqual : deepEqual, n, values);
break;
@ -67,7 +67,7 @@ function main({ n, len, method, strict }) {
}
case 'notDeepEqual_mixed': {
const values = array.map(
(_, i) => [i % 2 ? [`str_${i}`, 1] : `str_${i}`, 123]
(_, i) => [i % 2 ? [`str_${i}`, 1] : `str_${i}`, 123],
);
const values2 = values.slice(0);
values2[0] = ['w00t', 123];

View File

@ -5,7 +5,7 @@ const { Blob } = require('buffer');
const bench = common.createBenchmark(main, {
bytes: [128, 1024, 1024 ** 2],
n: [1e6],
operation: ['text', 'arrayBuffer']
operation: ['text', 'arrayBuffer'],
});
async function run(n, bytes, operation) {

View File

@ -5,7 +5,7 @@ const { File } = require('buffer');
const bench = common.createBenchmark(main, {
bytes: [128, 1024, 1024 ** 2],
n: [1e6],
operation: ['text', 'arrayBuffer']
operation: ['text', 'arrayBuffer'],
});
const options = {

View File

@ -9,7 +9,7 @@ if (!isWindows) messagesLength.push(32768);
const bench = common.createBenchmark(childProcessExecStdout, {
len: messagesLength,
dur: [5]
dur: [5],
});
function childProcessExecStdout({ dur, len }) {

View File

@ -15,7 +15,7 @@ if (process.argv[2] === 'child') {
64, 256, 1024, 4096, 16384, 65536,
65536 << 4, 65536 << 6 - 1,
],
dur: [5]
dur: [5],
});
const spawn = require('child_process').spawn;

View File

@ -14,7 +14,7 @@ if (os.platform() !== 'win32')
const bench = common.createBenchmark(main, {
len: messagesLength,
dur: [5]
dur: [5],
});
function main({ dur, len }) {

View File

@ -1,7 +1,7 @@
'use strict';
const common = require('../common.js');
const bench = common.createBenchmark(main, {
n: [1000]
n: [1000],
});
const spawn = require('child_process').spawn;

View File

@ -8,7 +8,7 @@ if (cluster.isMaster) {
payload: ['string', 'object'],
sendsPerBroadcast: [1, 10],
serialization: ['json', 'advanced'],
n: [1e5]
n: [1e5],
});
function main({
@ -16,7 +16,7 @@ if (cluster.isMaster) {
workers,
sendsPerBroadcast,
payload,
serialization
serialization,
}) {
const expectedPerBroadcast = sendsPerBroadcast * workers;
let readies = 0;

View File

@ -108,7 +108,7 @@ class Benchmark {
cliOptions[key] = [];
cliOptions[key].push(
// Infer the type from the config object and parse accordingly
typeof configs[key][0] === 'number' ? +value : value
typeof configs[key][0] === 'number' ? +value : value,
);
} else {
extraOptions[key] = value;
@ -148,7 +148,7 @@ class Benchmark {
const allowed = combinationFilter({ ...currConfig });
if (typeof allowed !== 'boolean') {
throw new TypeError(
'Combination filter must always return a boolean'
'Combination filter must always return a boolean',
);
}
if (allowed)
@ -183,7 +183,7 @@ class Benchmark {
}
this.config.benchmarker = used_benchmarker;
this.report(result, elapsed);
}
},
);
}

View File

@ -71,7 +71,7 @@ if (showProgress) {
const job = queue[i];
const child = fork(path.resolve(__dirname, job.filename), cli.optional.set, {
execPath: cli.optional[job.binary]
execPath: cli.optional[job.binary],
});
child.on('message', (data) => {

View File

@ -13,7 +13,7 @@ const bench = common.createBenchmark(main, {
num: [100],
chunks: [1, 2, 4, 8],
type: ['concat', 'multi'],
dur: [5]
dur: [5],
});
function main({ dur, len, num, type, chunks }) {

View File

@ -13,7 +13,7 @@ const bench = common.createBenchmark(main, {
num: [100],
chunks: [1, 2, 4, 8],
type: ['send', 'recv'],
dur: [5]
dur: [5],
});
function main({ dur, len, num, type, chunks }) {

View File

@ -12,7 +12,7 @@ const bench = common.createBenchmark(main, {
len: [1, 64, 256, 1024],
num: [100],
type: ['send', 'recv'],
dur: [5]
dur: [5],
});
function main({ dur, len, num, type }) {

View File

@ -12,7 +12,7 @@ const bench = common.createBenchmark(main, {
len: [1, 64, 256, 1024],
num: [100],
type: ['send', 'recv'],
dur: [5]
dur: [5],
});
function main({ dur, len, num, type }) {

View File

@ -11,7 +11,7 @@ const bench = common.createBenchmark(main, {
chunks: 4,
connections: [50, 500],
chunkedEnc: 1,
duration: 5
duration: 5,
});
function main({ apm, connections, duration, type, len, chunks, chunkedEnc }) {
@ -24,7 +24,7 @@ function main({ apm, connections, duration, type, len, chunks, chunkedEnc }) {
bench.http({
path,
connections,
duration
duration,
}, () => {
server.close();
if (done) done();
@ -44,14 +44,14 @@ function patch() {
if (name === 'request') {
als.enterWith({
url: req.url,
start: process.hrtime.bigint()
start: process.hrtime.bigint(),
});
res.on('finish', () => {
times.push({
...als.getStore(),
statusCode: res.statusCode,
end: process.hrtime.bigint()
end: process.hrtime.bigint(),
});
});
}
@ -74,7 +74,7 @@ function diagnostics_channel() {
function onStart(req) {
als.enterWith({
url: req.url,
start: process.hrtime.bigint()
start: process.hrtime.bigint(),
});
}
@ -82,7 +82,7 @@ function diagnostics_channel() {
times.push({
...als.getStore(),
statusCode: res.statusCode,
end: process.hrtime.bigint()
end: process.hrtime.bigint(),
});
}

View File

@ -16,7 +16,7 @@ function main({ n, subscribers }) {
}
const data = {
foo: 'bar'
foo: 'bar',
};
bench.start();

View File

@ -6,7 +6,7 @@ const { lookup } = require('dns').promises;
const bench = common.createBenchmark(main, {
name: ['127.0.0.1', '::1'],
all: ['true', 'false'],
n: [5e6]
n: [5e6],
});
function main({ name, n, all }) {

View File

@ -6,7 +6,7 @@ const lookup = require('dns').lookup;
const bench = common.createBenchmark(main, {
name: ['127.0.0.1', '::1'],
all: ['true', 'false'],
n: [5e6]
n: [5e6],
});
function main({ name, n, all }) {

View File

@ -4,7 +4,7 @@ const domain = require('domain');
const bench = common.createBenchmark(main, {
args: [0, 1, 2, 3],
n: [10]
n: [10],
});
const bdomain = domain.create();

View File

@ -5,14 +5,14 @@ const common = require('../common');
const bench = common.createBenchmark(main, {
n: [1e7],
}, {
flags: ['--expose-internals']
flags: ['--expose-internals'],
});
function main({ n }) {
const {
codes: {
ERR_INVALID_STATE,
}
},
} = require('internal/errors');
bench.start();
for (let i = 0; i < n; ++i)

View File

@ -5,7 +5,7 @@ const assert = require('assert');
const bench = common.createBenchmark(main, {
method: ['withoutdefaults', 'withdefaults'],
n: [1e8]
n: [1e8],
});
function oldStyleDefaults(x, y) {

View File

@ -5,7 +5,7 @@ const assert = require('assert');
const bench = common.createBenchmark(main, {
method: ['swap', 'destructure'],
n: [1e8]
n: [1e8],
});
function runSwapManual(n) {

View File

@ -4,7 +4,7 @@ const common = require('../common.js');
const bench = common.createBenchmark(main, {
method: ['normal', 'destructureObject'],
n: [1e8]
n: [1e8],
});
function runNormal(n) {

View File

@ -5,7 +5,7 @@ const common = require('../common.js');
const bench = common.createBenchmark(main, {
method: ['for', 'for-of', 'for-in', 'forEach'],
count: [5, 10, 20, 100],
n: [5e6]
n: [5e6],
});
function useFor(n, items, count) {

View File

@ -8,7 +8,7 @@ const bench = common.createBenchmark(main, {
'object', 'nullProtoObject', 'nullProtoLiteralObject', 'storageObject',
'fakeMap', 'map',
],
n: [1e6]
n: [1e6],
});
function runObject(n) {
@ -72,7 +72,7 @@ function fakeMap() {
get(key) { return m[`$${key}`]; },
set(key, val) { m[`$${key}`] = val; },
get size() { return Object.keys(m).length; },
has(key) { return Object.hasOwn(m, `$${key}`); }
has(key) { return Object.hasOwn(m, `$${key}`); },
};
}

View File

@ -5,7 +5,7 @@ const assert = require('assert');
const bench = common.createBenchmark(main, {
method: ['copy', 'rest', 'arguments'],
n: [1e8]
n: [1e8],
});
function copyArguments() {

View File

@ -6,7 +6,7 @@ const util = require('util');
const bench = common.createBenchmark(main, {
method: ['spread', 'assign', '_extend'],
count: [5, 10, 20],
n: [1e6]
n: [1e6],
});
function main({ n, context, count, rest, method }) {

View File

@ -8,7 +8,7 @@ const bench = common.createBenchmark(main, {
count: [5, 10, 20],
context: ['context', 'null'],
rest: [0, 1],
n: [5e6]
n: [5e6],
});
function makeTest(count, rest) {

View File

@ -9,7 +9,7 @@ const benchmarkDirectory =
path.resolve(tmpdir.path, 'benchmark-esm-parse');
const bench = common.createBenchmark(main, {
n: [1e2]
n: [1e2],
});
async function main({ n }) {

View File

@ -5,7 +5,7 @@ const EventEmitter = require('events').EventEmitter;
const bench = common.createBenchmark(main, {
n: [5e6],
listeners: [5, 50],
raw: ['true', 'false']
raw: ['true', 'false'],
});
function main({ n, listeners, raw }) {

View File

@ -4,7 +4,7 @@ const EventEmitter = require('events').EventEmitter;
const bench = common.createBenchmark(main, {
n: [2e7],
argc: [0, 1, 4, 5]
argc: [0, 1, 4, 5],
});
function main({ n, argc }) {

View File

@ -3,7 +3,7 @@ const common = require('../common.js');
const bench = common.createBenchmark(main, {
n: [1e6],
listeners: [1, 5, 10]
listeners: [1, 5, 10],
}, { flags: ['--expose-internals'] });
function main({ n, listeners }) {

View File

@ -8,7 +8,7 @@ const bench = common.createBenchmark(main, {
c: [50, 500],
chunkedEnc: [1, 0],
benchmarker: ['test-double-https'],
duration: 5
duration: 5,
});
function main({ type, len, chunks, c, chunkedEnc, duration }) {
@ -21,7 +21,7 @@ function main({ type, len, chunks, c, chunkedEnc, duration }) {
path,
connections: c,
scheme: 'https',
duration
duration,
}, () => {
server.close();
});

View File

@ -38,7 +38,7 @@ assert(js() === cxx());
const bench = common.createBenchmark(main, {
type: ['js', 'cxx', 'napi'],
n: [1e6, 1e7, 5e7]
n: [1e6, 1e7, 5e7],
});
function main({ n, type }) {

View File

@ -4,7 +4,7 @@ const common = require('../common.js');
const cpus = require('os').cpus;
const bench = common.createBenchmark(main, {
n: [3e4]
n: [3e4],
});
function main({ n }) {

View File

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

View File

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

View File

@ -18,7 +18,7 @@ function createTimingInfo({
endTime = 0,
encodedBodySize = 0,
decodedBodySize = 0,
finalConnectionTimingInfo = null
finalConnectionTimingInfo = null,
}) {
if (finalConnectionTimingInfo !== null) {
finalConnectionTimingInfo.domainLookupStartTime =
@ -61,7 +61,7 @@ function test() {
'http://localhost:8080',
'fetch',
{},
''
'',
);
}

View File

@ -4,11 +4,11 @@
const common = require('../common.js');
const configs = {
n: [1024]
n: [1024],
};
const options = {
flags: ['--expose-internals']
flags: ['--expose-internals'],
};
const bench = common.createBenchmark(main, configs, options);
@ -25,12 +25,12 @@ function main(conf) {
integrity: `sha256-${hash(`// ./_${i}`, 'sha256')}`,
dependencies: Object.fromEntries(Array.from({
// Average 3 deps per 4 modules
length: Math.floor((i % 4) / 2)
length: Math.floor((i % 4) / 2),
}, (_, ii) => {
return [`_${ii}`, `./_${i - ii}`];
})),
}];
})
}),
);
const json = JSON.parse(JSON.stringify({ resources }), (_, o) => {
if (o && typeof o === 'object') {

View File

@ -12,22 +12,22 @@ function main({ type, n }) {
noencode: {
foo: 'bar',
baz: 'quux',
xyzzy: 'thud'
xyzzy: 'thud',
},
encodemany: {
'\u0080\u0083\u0089': 'bar',
'\u008C\u008E\u0099': 'quux',
'xyzzy': '\u00A5q\u00A3r'
'xyzzy': '\u00A5q\u00A3r',
},
encodelast: {
foo: 'bar',
baz: 'quux',
xyzzy: 'thu\u00AC'
xyzzy: 'thu\u00AC',
},
array: {
foo: [],
baz: ['bar'],
xyzzy: ['bar', 'quux', 'thud']
xyzzy: ['bar', 'quux', 'thud'],
},
multiprimitives: {
foo: false,

View File

@ -27,7 +27,7 @@ function getLoremIpsumStream(repetitions) {
});
let i = 0;
readable._read = () => readable.push(
i++ >= repetitions ? null : loremIpsum
i++ >= repetitions ? null : loremIpsum,
);
return readable;
}

View File

@ -42,7 +42,7 @@ if (format === 'csv') {
const filename = benchmarks[i];
const child = fork(
path.resolve(__dirname, filename),
cli.test ? ['--test'] : cli.optional.set
cli.test ? ['--test'] : cli.optional.set,
);
if (format !== 'csv') {

View File

@ -9,7 +9,7 @@ const {
const bench = common.createBenchmark(main, {
n: [50e6],
kind: ['duplex', 'readable', 'transform', 'writable']
kind: ['duplex', 'readable', 'transform', 'writable'],
});
function main({ n, kind }) {

View File

@ -9,7 +9,7 @@ const {
const bench = common.createBenchmark(main, {
n: [1e6],
kind: ['duplex', 'readable', 'transform', 'writable']
kind: ['duplex', 'readable', 'transform', 'writable'],
});
function main({ n, kind }) {

View File

@ -4,7 +4,7 @@ const common = require('../common');
const { Readable, Writable } = require('stream');
const bench = common.createBenchmark(main, {
n: [5e6]
n: [5e6],
});
function main({ n }) {

View File

@ -4,7 +4,7 @@ const common = require('../common');
const { Readable, Writable } = require('stream');
const bench = common.createBenchmark(main, {
n: [5e6]
n: [5e6],
});
function main({ n }) {

View File

@ -21,7 +21,7 @@ async function main({ n, sync }) {
this.push(1);
});
}
}
},
});
bench.start();

View File

@ -4,7 +4,7 @@ const common = require('../common');
const Readable = require('stream').Readable;
const bench = common.createBenchmark(main, {
n: [1e3]
n: [1e3],
});
function main({ n }) {

View File

@ -4,7 +4,7 @@ const common = require('../common');
const Readable = require('stream').Readable;
const bench = common.createBenchmark(main, {
n: [1e3]
n: [1e3],
});
function main({ n }) {

View File

@ -5,7 +5,7 @@ const Readable = require('stream').Readable;
const bench = common.createBenchmark(main, {
n: [200e1],
type: ['string', 'buffer']
type: ['string', 'buffer'],
});
function main({ n, type }) {

View File

@ -4,7 +4,7 @@ const common = require('../common');
const Readable = require('stream').Readable;
const bench = common.createBenchmark(main, {
n: [50e2]
n: [50e2],
});
function main({ n }) {

View File

@ -4,7 +4,7 @@ const common = require('../common');
const Readable = require('stream').Readable;
const bench = common.createBenchmark(main, {
n: [1e3]
n: [1e3],
});
function main({ n }) {

View File

@ -8,7 +8,7 @@ const bench = common.createBenchmark(main, {
sync: ['yes', 'no'],
writev: ['yes', 'no'],
callback: ['yes', 'no'],
len: [1024, 32 * 1024]
len: [1024, 32 * 1024],
});
function main({ n, sync, writev, callback, len }) {

View File

@ -6,7 +6,7 @@ const bench = common.createBenchmark(main, {
encoding: [
'ascii', 'utf8', 'utf-8', 'base64', 'ucs2', 'UTF-8', 'AscII', 'UTF-16LE',
],
n: [25e6]
n: [25e6],
});
function main({ encoding, n }) {

View File

@ -6,7 +6,7 @@ const bench = common.createBenchmark(main, {
encoding: ['ascii', 'utf8', 'base64-utf8', 'base64-ascii', 'utf16le'],
inLen: [32, 128, 1024, 4096],
chunkLen: [16, 64, 256, 1024],
n: [25e5]
n: [25e5],
});
const UTF8_ALPHA = 'Blåbærsyltetøy';

View File

@ -3,7 +3,7 @@ const common = require('../common.js');
const bench = common.createBenchmark(main, {
n: [5e6],
type: ['depth', 'depth1', 'breadth', 'breadth1', 'breadth4', 'clear']
type: ['depth', 'depth1', 'breadth', 'breadth1', 'breadth4', 'clear'],
});
function main({ n, type }) {

View File

@ -2,7 +2,7 @@
const common = require('../common.js');
const bench = common.createBenchmark(main, {
n: [5e6]
n: [5e6],
});
function main({ n }) {

View File

@ -2,7 +2,7 @@
const common = require('../common.js');
const bench = common.createBenchmark(main, {
n: [1e7]
n: [1e7],
});
function main({ n }) {

View File

@ -2,7 +2,7 @@
const common = require('../common.js');
const bench = common.createBenchmark(main, {
n: [5e6]
n: [5e6],
});
function main({ n }) {

View File

@ -4,7 +4,7 @@ const assert = require('assert');
const bench = common.createBenchmark(main, {
n: [1e6],
direction: ['start', 'end']
direction: ['start', 'end'],
});
function main({ n, direction }) {

View File

@ -4,7 +4,7 @@ const assert = require('assert');
const bench = common.createBenchmark(main, {
n: [1e6],
direction: ['start', 'end']
direction: ['start', 'end'],
});
function main({ direction, n }) {

View File

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

View File

@ -3,9 +3,9 @@ const common = require('../common.js');
const bench = common.createBenchmark(main, {
dur: [5],
securing: ['SecurePair', 'TLSSocket', 'clear'],
size: [100, 1024, 1024 * 1024]
size: [100, 1024, 1024 * 1024],
}, {
flags: ['--no-warnings']
flags: ['--no-warnings'],
});
const fixtures = require('../../test/common/fixtures');

View File

@ -3,7 +3,7 @@ const common = require('../common.js');
const bench = common.createBenchmark(main, {
dur: [5],
type: ['buf', 'asc', 'utf'],
size: [100, 1024, 1024 * 1024, 4 * 1024 * 1024, 16 * 1024 * 1024]
size: [100, 1024, 1024 * 1024, 4 * 1024 * 1024, 16 * 1024 * 1024],
});
const fixtures = require('../../test/common/fixtures');

View File

@ -5,7 +5,7 @@ const bench = common.createBenchmark(main, {
type: ['buf', 'asc', 'utf'],
sendchunklen: [256, 32 * 1024, 128 * 1024, 16 * 1024 * 1024],
recvbuflen: [0, 64 * 1024, 1024 * 1024],
recvbufgenfn: ['true', 'false']
recvbufgenfn: ['true', 'false'],
});
const fixtures = require('../../test/common/fixtures');
@ -68,8 +68,8 @@ function main({ dur, type, sendchunklen, recvbuflen, recvbufgenfn }) {
buffer,
callback: function(nread, buf) {
received += nread;
}
}
},
},
};
}

View File

@ -5,7 +5,7 @@ const tls = require('tls');
const common = require('../common.js');
const bench = common.createBenchmark(main, {
concurrency: [1, 10],
dur: [5]
dur: [5],
});
let clientConn = 0;
@ -43,7 +43,7 @@ function onConnection(conn) {
function makeConnection() {
const options = {
port: common.PORT,
rejectUnauthorized: false
rejectUnauthorized: false,
};
const conn = tls.connect(options, () => {
clientConn++;

View File

@ -8,7 +8,7 @@ const bench = common.createBenchmark(main, {
'getHeapStatistics',
'getHeapSpaceStatistics',
],
n: [1e6]
n: [1e6],
});
function main({ method, n }) {

View File

@ -5,7 +5,7 @@ const v8 = require('v8');
const bench = common.createBenchmark(main, {
len: [256, 1024 * 16, 1024 * 512],
n: [1e6]
n: [1e6],
});
function main({ n, len }) {

View File

@ -3,7 +3,7 @@
const common = require('../common.js');
const bench = common.createBenchmark(main, {
n: [100]
n: [100],
});
const vm = require('vm');

View File

@ -5,7 +5,7 @@ const common = require('../common.js');
const bench = common.createBenchmark(main, {
n: [1],
breakOnSigint: [0, 1],
withSigintListener: [0, 1]
withSigintListener: [0, 1],
});
const vm = require('vm');

View File

@ -5,7 +5,7 @@ const common = require('../common.js');
const bench = common.createBenchmark(main, {
n: [1],
breakOnSigint: [0, 1],
withSigintListener: [0, 1]
withSigintListener: [0, 1],
});
const vm = require('vm');

View File

@ -9,7 +9,7 @@ const assert = require('assert');
const bench = common.createBenchmark(main, {
n: [50e3],
kind: ['ReadableStream', 'TransformStream', 'WritableStream']
kind: ['ReadableStream', 'TransformStream', 'WritableStream'],
});
let rs, ws, ts;

View File

@ -23,7 +23,7 @@ async function main({ n, highWaterMarkR, highWaterMarkW }) {
} else {
controller.close();
}
}
},
});
const ws = new WritableStream({
highWaterMark: highWaterMarkW,

View File

@ -13,7 +13,7 @@ async function main({ n }) {
const rs = new ReadableStream({
pull: function(controller) {
controller.enqueue(1);
}
},
});
let x = 0;

View File

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

View File

@ -7,7 +7,7 @@ const bench = common.createBenchmark(main, {
workers: [1],
payload: ['string', 'object'],
sendsPerBroadcast: [1, 10],
n: [1e5]
n: [1e5],
});
const workerPath = path.resolve(__dirname, '..', 'fixtures', 'echo.worker.js');

View File

@ -5,7 +5,7 @@ const { MessageChannel } = require('worker_threads');
const bench = common.createBenchmark(main, {
payload: ['string', 'object'],
style: ['eventtarget', 'eventemitter'],
n: [1e6]
n: [1e6],
});
function main(conf) {

View File

@ -5,7 +5,7 @@ const zlib = require('zlib');
const bench = common.createBenchmark(main, {
inputLen: [16 * 1024 * 1024],
chunkLen: [1024],
n: [1e2]
n: [1e2],
});
function main({ n, inputLen, chunkLen }) {

View File

@ -8,7 +8,7 @@ const bench = common.createBenchmark(main, {
'BrotliCompress', 'BrotliDecompress',
],
options: ['true', 'false'],
n: [5e5]
n: [5e5],
});
function main({ n, type, options }) {

View File

@ -5,7 +5,7 @@ const zlib = require('zlib');
const bench = common.createBenchmark(main, {
method: ['createDeflate', 'deflate', 'deflateSync'],
inputLen: [1024],
n: [4e5]
n: [4e5],
});
function main({ n, method, inputLen }) {

View File

@ -5,7 +5,7 @@ const zlib = require('zlib');
const bench = common.createBenchmark(main, {
method: ['inflate', 'inflateSync'],
inputLen: [1024],
n: [4e5]
n: [4e5],
});
function main({ n, method, inputLen }) {

View File

@ -7,12 +7,12 @@ const bench = common.createBenchmark(main, {
inputLen: [1024],
duration: [5],
type: ['string', 'buffer'],
algorithm: ['gzip', 'brotli']
algorithm: ['gzip', 'brotli'],
}, {
test: {
inputLen: 1024,
duration: 0.2
}
duration: 0.2,
},
});
function main({ inputLen, duration, type, algorithm }) {