From 4b89ec409f94ca56d99b44868afe49d73204c42b Mon Sep 17 00:00:00 2001 From: Antoine du Hamel Date: Sun, 12 Feb 2023 17:32:00 +0100 Subject: [PATCH] benchmark: add trailing commas in `benchmark/http` PR-URL: https://github.com/nodejs/node/pull/46609 Reviewed-By: Darshan Sen Reviewed-By: Mohammed Keyvanzadeh Reviewed-By: James M Snell Reviewed-By: Moshe Atlow --- benchmark/.eslintrc.yaml | 1 - benchmark/http/bench-parser.js | 4 ++-- benchmark/http/check_invalid_header_char.js | 2 +- benchmark/http/chunked.js | 2 +- benchmark/http/client-request-body.js | 4 ++-- benchmark/http/cluster.js | 2 +- benchmark/http/create-clientrequest.js | 4 ++-- benchmark/http/end-vs-write-end.js | 2 +- benchmark/http/headers.js | 2 +- benchmark/http/http_server_for_chunky_client.js | 4 ++-- benchmark/http/incoming_headers.js | 4 ++-- benchmark/http/set-header.js | 2 +- benchmark/http/simple.js | 2 +- benchmark/http/upgrade.js | 2 +- 14 files changed, 18 insertions(+), 19 deletions(-) diff --git a/benchmark/.eslintrc.yaml b/benchmark/.eslintrc.yaml index e212f5419a453a..6b97461975f1c0 100644 --- a/benchmark/.eslintrc.yaml +++ b/benchmark/.eslintrc.yaml @@ -9,7 +9,6 @@ rules: overrides: - files: - - http/*.js - path/*.js rules: comma-dangle: [error, { diff --git a/benchmark/http/bench-parser.js b/benchmark/http/bench-parser.js index e514ce7e754cba..6b8bbd8808c720 100644 --- a/benchmark/http/bench-parser.js +++ b/benchmark/http/bench-parser.js @@ -4,9 +4,9 @@ const common = require('../common'); const bench = common.createBenchmark(main, { len: [4, 8, 16, 32], - n: [1e5] + n: [1e5], }, { - flags: ['--expose-internals', '--no-warnings'] + flags: ['--expose-internals', '--no-warnings'], }); function main({ len, n }) { diff --git a/benchmark/http/check_invalid_header_char.js b/benchmark/http/check_invalid_header_char.js index 29439e3499d19e..bd250cd5fe0206 100644 --- a/benchmark/http/check_invalid_header_char.js +++ b/benchmark/http/check_invalid_header_char.js @@ -23,7 +23,7 @@ const groupedInputs = { // Put it here so the benchmark result lines will not be super long. LONG_AND_INVALID: ['Here is a value that is really a folded header ' + - 'value\r\n this should be supported, but it is not currently'] + 'value\r\n this should be supported, but it is not currently'], }; const inputs = [ diff --git a/benchmark/http/chunked.js b/benchmark/http/chunked.js index ec86d0a1f65295..96a12eda7965c1 100644 --- a/benchmark/http/chunked.js +++ b/benchmark/http/chunked.js @@ -14,7 +14,7 @@ const bench = common.createBenchmark(main, { n: [1, 4, 8, 16], len: [1, 64, 256], c: [100], - duration: 5 + duration: 5, }); function main({ len, n, c, duration }) { diff --git a/benchmark/http/client-request-body.js b/benchmark/http/client-request-body.js index 3d673d36b7bc63..16a652d7189b5a 100644 --- a/benchmark/http/client-request-body.js +++ b/benchmark/http/client-request-body.js @@ -8,7 +8,7 @@ const bench = common.createBenchmark(main, { dur: [5], type: ['asc', 'utf', 'buf'], len: [32, 256, 1024], - method: ['write', 'end'] + method: ['write', 'end'], }); function main({ dur, len, type, method }) { @@ -33,7 +33,7 @@ function main({ dur, len, type, method }) { agent: new http.Agent({ maxSockets: 1 }), host: '127.0.0.1', path: '/', - method: 'POST' + method: 'POST', }; const server = http.createServer((req, res) => { diff --git a/benchmark/http/cluster.js b/benchmark/http/cluster.js index 0d97b516ec506b..ea0d925d8c94c4 100644 --- a/benchmark/http/cluster.js +++ b/benchmark/http/cluster.js @@ -34,7 +34,7 @@ function main({ type, len, c, duration }) { bench.http({ path: path, connections: c, - duration + duration, }, () => { w1.destroy(); w2.destroy(); diff --git a/benchmark/http/create-clientrequest.js b/benchmark/http/create-clientrequest.js index 24d6e020c63bc0..b245b67ebdaae3 100644 --- a/benchmark/http/create-clientrequest.js +++ b/benchmark/http/create-clientrequest.js @@ -11,7 +11,7 @@ const bench = common.createBenchmark(main, { // Use 'url' to avoid name clash with other http benchmark url: types.concat(['wpt']), arg: ['URL', 'string', 'options'], - e: [1] + e: [1], }); function noop() {} @@ -25,7 +25,7 @@ function main({ url: type, arg, e }) { switch (arg) { case 'options': { const options = data.map((i) => ({ - path: new URL(i).path, createConnection: noop + path: new URL(i).path, createConnection: noop, })); bench.start(); for (let i = 0; i < len; i++) { diff --git a/benchmark/http/end-vs-write-end.js b/benchmark/http/end-vs-write-end.js index 9f128bf8c1499e..d344a3ebcc6f45 100644 --- a/benchmark/http/end-vs-write-end.js +++ b/benchmark/http/end-vs-write-end.js @@ -15,7 +15,7 @@ const bench = common.createBenchmark(main, { len: [64 * 1024, 128 * 1024, 256 * 1024, 1024 * 1024], c: [100], method: ['write', 'end'], - duration: 5 + duration: 5, }); function main({ len, type, method, c, duration }) { diff --git a/benchmark/http/headers.js b/benchmark/http/headers.js index b405868eb0ea2b..e995f380cef151 100644 --- a/benchmark/http/headers.js +++ b/benchmark/http/headers.js @@ -6,7 +6,7 @@ const http = require('http'); const bench = common.createBenchmark(main, { n: [10, 600], len: [1, 100], - duration: 5 + duration: 5, }); function main({ len, n, duration }) { diff --git a/benchmark/http/http_server_for_chunky_client.js b/benchmark/http/http_server_for_chunky_client.js index dafaf9122efc86..2ab4e3502efb9c 100644 --- a/benchmark/http/http_server_for_chunky_client.js +++ b/benchmark/http/http_server_for_chunky_client.js @@ -15,7 +15,7 @@ tmpdir.refresh(); const server = http.createServer({ maxHeaderSize: 64000 }, (req, res) => { const headers = { 'content-type': 'text/plain', - 'content-length': '2' + 'content-length': '2', }; res.writeHead(200, headers); res.end('ok'); @@ -28,7 +28,7 @@ server.listen(PIPE); const child = fork( `${__dirname}/_chunky_http_client.js`, - process.argv.slice(2) + process.argv.slice(2), ); child.on('message', (data) => { if (data.type === 'report') { diff --git a/benchmark/http/incoming_headers.js b/benchmark/http/incoming_headers.js index 7501d2cb92d456..21e15fcd7d6981 100644 --- a/benchmark/http/incoming_headers.js +++ b/benchmark/http/incoming_headers.js @@ -6,7 +6,7 @@ const bench = common.createBenchmark(main, { connections: [50], // Concurrent connections headers: [20], // Number of header lines to append after the common headers w: [0, 6], // Amount of trailing whitespace - duration: 5 + duration: 5, }); function main({ connections, headers, w, duration }) { @@ -20,7 +20,7 @@ function main({ connections, headers, w, duration }) { 'Accept': 'text/plain', 'User-Agent': 'nodejs-benchmark', 'Date': new Date().toString(), - 'Cache-Control': 'no-cache' + 'Cache-Control': 'no-cache', }; for (let i = 0; i < headers; i++) { // Note: diff --git a/benchmark/http/set-header.js b/benchmark/http/set-header.js index 47681ebd1b1405..8bf00b84ad0a5a 100644 --- a/benchmark/http/set-header.js +++ b/benchmark/http/set-header.js @@ -3,7 +3,7 @@ const common = require('../common.js'); const bench = common.createBenchmark(main, { res: ['normal', 'setHeader', 'setHeaderWH'], - duration: 5 + duration: 5, }); const type = 'bytes'; diff --git a/benchmark/http/simple.js b/benchmark/http/simple.js index 31e12ca7c27438..125cc5cf000d8d 100644 --- a/benchmark/http/simple.js +++ b/benchmark/http/simple.js @@ -8,7 +8,7 @@ const bench = common.createBenchmark(main, { chunks: [1, 4], c: [50, 500], chunkedEnc: [1, 0], - duration: 5 + duration: 5, }); function main({ type, len, chunks, c, chunkedEnc, duration }) { diff --git a/benchmark/http/upgrade.js b/benchmark/http/upgrade.js index c4f5cd342284c3..487d76f9ac228c 100644 --- a/benchmark/http/upgrade.js +++ b/benchmark/http/upgrade.js @@ -4,7 +4,7 @@ const common = require('../common.js'); const net = require('net'); const bench = common.createBenchmark(main, { - n: [5, 1000] + n: [5, 1000], }); const reqData = 'GET / HTTP/1.1\r\n' +