Skip to content

Commit 6f91c8e

Browse files
aduh95juanarbol
authored andcommitted
benchmark: add trailing commas
PR-URL: #46370 Reviewed-By: Yagiz Nizipli <[email protected]> Reviewed-By: Moshe Atlow <[email protected]> Reviewed-By: James M Snell <[email protected]>
1 parent 92f0747 commit 6f91c8e

File tree

83 files changed

+133
-115
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

83 files changed

+133
-115
lines changed

benchmark/.eslintrc.yaml

+25-7
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,29 @@ env:
55
es6: true
66

77
rules:
8-
comma-dangle: [error, {
9-
arrays: always-multiline,
10-
exports: always-multiline,
11-
functions: only-multiline,
12-
imports: always-multiline,
13-
objects: only-multiline,
14-
}]
158
prefer-arrow-callback: error
9+
10+
overrides:
11+
- files:
12+
- async_hooks/*.js
13+
- buffers/*.js
14+
- buffers-fill/*.js
15+
- crypto/*.js
16+
- fs/*.js
17+
- http/*.js
18+
- http2/*.js
19+
- misc/*.js
20+
- module/*.js
21+
- net/*.js
22+
- path/*.js
23+
- process/*.js
24+
- url/*.js
25+
- util/*.js
26+
rules:
27+
comma-dangle: [error, {
28+
arrays: always-multiline,
29+
exports: always-multiline,
30+
functions: only-multiline,
31+
imports: always-multiline,
32+
objects: only-multiline,
33+
}]

benchmark/_http-benchmarkers.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ class TestDoubleBenchmarker {
106106
const scheme = options.scheme || 'http';
107107
const env = {
108108
test_url: `${scheme}://127.0.0.1:${options.port}${options.path}`,
109-
...process.env
109+
...process.env,
110110
};
111111

112112
const child = child_process.fork(this.executable,
@@ -203,7 +203,7 @@ exports.run = function(options, callback) {
203203
connections: 100,
204204
duration: 5,
205205
benchmarker: exports.default_http_benchmarker,
206-
...options
206+
...options,
207207
};
208208
if (!options.benchmarker) {
209209
callback(new Error('Could not locate required http benchmarker. See ' +

benchmark/assert/deepequal-map.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ function main({ n, len, method, strict }) {
4646
}
4747
case 'deepEqual_mixed': {
4848
const values = array.map(
49-
(_, i) => [i % 2 ? [`str_${i}`, 1] : `str_${i}`, 123]
49+
(_, i) => [i % 2 ? [`str_${i}`, 1] : `str_${i}`, 123],
5050
);
5151
benchmark(strict ? deepStrictEqual : deepEqual, n, values);
5252
break;
@@ -67,7 +67,7 @@ function main({ n, len, method, strict }) {
6767
}
6868
case 'notDeepEqual_mixed': {
6969
const values = array.map(
70-
(_, i) => [i % 2 ? [`str_${i}`, 1] : `str_${i}`, 123]
70+
(_, i) => [i % 2 ? [`str_${i}`, 1] : `str_${i}`, 123],
7171
);
7272
const values2 = values.slice(0);
7373
values2[0] = ['w00t', 123];

benchmark/blob/blob.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ const { Blob } = require('buffer');
55
const bench = common.createBenchmark(main, {
66
bytes: [128, 1024, 1024 ** 2],
77
n: [1e6],
8-
operation: ['text', 'arrayBuffer']
8+
operation: ['text', 'arrayBuffer'],
99
});
1010

1111
async function run(n, bytes, operation) {

benchmark/blob/file.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ const { File } = require('buffer');
55
const bench = common.createBenchmark(main, {
66
bytes: [128, 1024, 1024 ** 2],
77
n: [1e6],
8-
operation: ['text', 'arrayBuffer']
8+
operation: ['text', 'arrayBuffer'],
99
});
1010

1111
const options = {

benchmark/child_process/child-process-exec-stdout.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ if (!isWindows) messagesLength.push(32768);
99

1010
const bench = common.createBenchmark(childProcessExecStdout, {
1111
len: messagesLength,
12-
dur: [5]
12+
dur: [5],
1313
});
1414

1515
function childProcessExecStdout({ dur, len }) {

benchmark/child_process/child-process-read-ipc.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ if (process.argv[2] === 'child') {
1515
64, 256, 1024, 4096, 16384, 65536,
1616
65536 << 4, 65536 << 6 - 1,
1717
],
18-
dur: [5]
18+
dur: [5],
1919
});
2020
const spawn = require('child_process').spawn;
2121

benchmark/child_process/child-process-read.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ if (os.platform() !== 'win32')
1414

1515
const bench = common.createBenchmark(main, {
1616
len: messagesLength,
17-
dur: [5]
17+
dur: [5],
1818
});
1919

2020
function main({ dur, len }) {

benchmark/child_process/spawn-echo.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
'use strict';
22
const common = require('../common.js');
33
const bench = common.createBenchmark(main, {
4-
n: [1000]
4+
n: [1000],
55
});
66

77
const spawn = require('child_process').spawn;

benchmark/cluster/echo.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,15 @@ if (cluster.isMaster) {
88
payload: ['string', 'object'],
99
sendsPerBroadcast: [1, 10],
1010
serialization: ['json', 'advanced'],
11-
n: [1e5]
11+
n: [1e5],
1212
});
1313

1414
function main({
1515
n,
1616
workers,
1717
sendsPerBroadcast,
1818
payload,
19-
serialization
19+
serialization,
2020
}) {
2121
const expectedPerBroadcast = sendsPerBroadcast * workers;
2222
let readies = 0;

benchmark/common.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ class Benchmark {
108108
cliOptions[key] = [];
109109
cliOptions[key].push(
110110
// Infer the type from the config object and parse accordingly
111-
typeof configs[key][0] === 'number' ? +value : value
111+
typeof configs[key][0] === 'number' ? +value : value,
112112
);
113113
} else {
114114
extraOptions[key] = value;
@@ -148,7 +148,7 @@ class Benchmark {
148148
const allowed = combinationFilter({ ...currConfig });
149149
if (typeof allowed !== 'boolean') {
150150
throw new TypeError(
151-
'Combination filter must always return a boolean'
151+
'Combination filter must always return a boolean',
152152
);
153153
}
154154
if (allowed)
@@ -183,7 +183,7 @@ class Benchmark {
183183
}
184184
this.config.benchmarker = used_benchmarker;
185185
this.report(result, elapsed);
186-
}
186+
},
187187
);
188188
}
189189

benchmark/compare.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ if (showProgress) {
7171
const job = queue[i];
7272

7373
const child = fork(path.resolve(__dirname, job.filename), cli.optional.set, {
74-
execPath: cli.optional[job.binary]
74+
execPath: cli.optional[job.binary],
7575
});
7676

7777
child.on('message', (data) => {

benchmark/dgram/array-vs-concat.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ const bench = common.createBenchmark(main, {
1313
num: [100],
1414
chunks: [1, 2, 4, 8],
1515
type: ['concat', 'multi'],
16-
dur: [5]
16+
dur: [5],
1717
});
1818

1919
function main({ dur, len, num, type, chunks }) {

benchmark/dgram/multi-buffer.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ const bench = common.createBenchmark(main, {
1313
num: [100],
1414
chunks: [1, 2, 4, 8],
1515
type: ['send', 'recv'],
16-
dur: [5]
16+
dur: [5],
1717
});
1818

1919
function main({ dur, len, num, type, chunks }) {

benchmark/dgram/offset-length.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ const bench = common.createBenchmark(main, {
1212
len: [1, 64, 256, 1024],
1313
num: [100],
1414
type: ['send', 'recv'],
15-
dur: [5]
15+
dur: [5],
1616
});
1717

1818
function main({ dur, len, num, type }) {

benchmark/dgram/single-buffer.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ const bench = common.createBenchmark(main, {
1212
len: [1, 64, 256, 1024],
1313
num: [100],
1414
type: ['send', 'recv'],
15-
dur: [5]
15+
dur: [5],
1616
});
1717

1818
function main({ dur, len, num, type }) {

benchmark/diagnostics_channel/http.js

+6-6
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ const bench = common.createBenchmark(main, {
1111
chunks: 4,
1212
connections: [50, 500],
1313
chunkedEnc: 1,
14-
duration: 5
14+
duration: 5,
1515
});
1616

1717
function main({ apm, connections, duration, type, len, chunks, chunkedEnc }) {
@@ -24,7 +24,7 @@ function main({ apm, connections, duration, type, len, chunks, chunkedEnc }) {
2424
bench.http({
2525
path,
2626
connections,
27-
duration
27+
duration,
2828
}, () => {
2929
server.close();
3030
if (done) done();
@@ -44,14 +44,14 @@ function patch() {
4444
if (name === 'request') {
4545
als.enterWith({
4646
url: req.url,
47-
start: process.hrtime.bigint()
47+
start: process.hrtime.bigint(),
4848
});
4949

5050
res.on('finish', () => {
5151
times.push({
5252
...als.getStore(),
5353
statusCode: res.statusCode,
54-
end: process.hrtime.bigint()
54+
end: process.hrtime.bigint(),
5555
});
5656
});
5757
}
@@ -74,15 +74,15 @@ function diagnostics_channel() {
7474
function onStart(req) {
7575
als.enterWith({
7676
url: req.url,
77-
start: process.hrtime.bigint()
77+
start: process.hrtime.bigint(),
7878
});
7979
}
8080

8181
function onFinish(res) {
8282
times.push({
8383
...als.getStore(),
8484
statusCode: res.statusCode,
85-
end: process.hrtime.bigint()
85+
end: process.hrtime.bigint(),
8686
});
8787
}
8888

benchmark/diagnostics_channel/publish.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ function main({ n, subscribers }) {
1616
}
1717

1818
const data = {
19-
foo: 'bar'
19+
foo: 'bar',
2020
};
2121

2222
bench.start();

benchmark/dns/lookup-promises.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ const { lookup } = require('dns').promises;
66
const bench = common.createBenchmark(main, {
77
name: ['127.0.0.1', '::1'],
88
all: ['true', 'false'],
9-
n: [5e6]
9+
n: [5e6],
1010
});
1111

1212
function main({ name, n, all }) {

benchmark/dns/lookup.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ const lookup = require('dns').lookup;
66
const bench = common.createBenchmark(main, {
77
name: ['127.0.0.1', '::1'],
88
all: ['true', 'false'],
9-
n: [5e6]
9+
n: [5e6],
1010
});
1111

1212
function main({ name, n, all }) {

benchmark/domain/domain-fn-args.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ const domain = require('domain');
44

55
const bench = common.createBenchmark(main, {
66
args: [0, 1, 2, 3],
7-
n: [10]
7+
n: [10],
88
});
99

1010
const bdomain = domain.create();

benchmark/error/node-error.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@ const common = require('../common');
55
const bench = common.createBenchmark(main, {
66
n: [1e7],
77
}, {
8-
flags: ['--expose-internals']
8+
flags: ['--expose-internals'],
99
});
1010

1111
function main({ n }) {
1212
const {
1313
codes: {
1414
ERR_INVALID_STATE,
15-
}
15+
},
1616
} = require('internal/errors');
1717
bench.start();
1818
for (let i = 0; i < n; ++i)

benchmark/es/defaultparams-bench.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ const assert = require('assert');
55

66
const bench = common.createBenchmark(main, {
77
method: ['withoutdefaults', 'withdefaults'],
8-
n: [1e8]
8+
n: [1e8],
99
});
1010

1111
function oldStyleDefaults(x, y) {

benchmark/es/destructuring-bench.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ const assert = require('assert');
55

66
const bench = common.createBenchmark(main, {
77
method: ['swap', 'destructure'],
8-
n: [1e8]
8+
n: [1e8],
99
});
1010

1111
function runSwapManual(n) {

benchmark/es/destructuring-object-bench.js

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

55
const bench = common.createBenchmark(main, {
66
method: ['normal', 'destructureObject'],
7-
n: [1e8]
7+
n: [1e8],
88
});
99

1010
function runNormal(n) {

benchmark/es/foreach-bench.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ const common = require('../common.js');
55
const bench = common.createBenchmark(main, {
66
method: ['for', 'for-of', 'for-in', 'forEach'],
77
count: [5, 10, 20, 100],
8-
n: [5e6]
8+
n: [5e6],
99
});
1010

1111
function useFor(n, items, count) {

benchmark/es/map-bench.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ const bench = common.createBenchmark(main, {
88
'object', 'nullProtoObject', 'nullProtoLiteralObject', 'storageObject',
99
'fakeMap', 'map',
1010
],
11-
n: [1e6]
11+
n: [1e6],
1212
});
1313

1414
function runObject(n) {
@@ -72,7 +72,7 @@ function fakeMap() {
7272
get(key) { return m[`$${key}`]; },
7373
set(key, val) { m[`$${key}`] = val; },
7474
get size() { return Object.keys(m).length; },
75-
has(key) { return Object.hasOwn(m, `$${key}`); }
75+
has(key) { return Object.hasOwn(m, `$${key}`); },
7676
};
7777
}
7878

benchmark/es/restparams-bench.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ const assert = require('assert');
55

66
const bench = common.createBenchmark(main, {
77
method: ['copy', 'rest', 'arguments'],
8-
n: [1e8]
8+
n: [1e8],
99
});
1010

1111
function copyArguments() {

benchmark/es/spread-assign.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ const util = require('util');
66
const bench = common.createBenchmark(main, {
77
method: ['spread', 'assign', '_extend'],
88
count: [5, 10, 20],
9-
n: [1e6]
9+
n: [1e6],
1010
});
1111

1212
function main({ n, context, count, rest, method }) {

0 commit comments

Comments
 (0)