Skip to content

Commit

Permalink
benchmark: add trailing commas in benchmark/http
Browse files Browse the repository at this point in the history
PR-URL: #46609
Reviewed-By: Darshan Sen <raisinten@gmail.com>
Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
  • Loading branch information
aduh95 authored and MylesBorins committed Feb 18, 2023
1 parent c0983cf commit 4b89ec4
Show file tree
Hide file tree
Showing 14 changed files with 18 additions and 19 deletions.
1 change: 0 additions & 1 deletion benchmark/.eslintrc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ rules:

overrides:
- files:
- http/*.js
- path/*.js
rules:
comma-dangle: [error, {
Expand Down
4 changes: 2 additions & 2 deletions benchmark/http/bench-parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 }) {
Expand Down
2 changes: 1 addition & 1 deletion benchmark/http/check_invalid_header_char.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [
Expand Down
2 changes: 1 addition & 1 deletion benchmark/http/chunked.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 }) {
Expand Down
4 changes: 2 additions & 2 deletions benchmark/http/client-request-body.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 }) {
Expand All @@ -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) => {
Expand Down
2 changes: 1 addition & 1 deletion benchmark/http/cluster.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ function main({ type, len, c, duration }) {
bench.http({
path: path,
connections: c,
duration
duration,
}, () => {
w1.destroy();
w2.destroy();
Expand Down
4 changes: 2 additions & 2 deletions benchmark/http/create-clientrequest.js
Original file line number Diff line number Diff line change
Expand Up @@ -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() {}
Expand All @@ -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++) {
Expand Down
2 changes: 1 addition & 1 deletion benchmark/http/end-vs-write-end.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 }) {
Expand Down
2 changes: 1 addition & 1 deletion benchmark/http/headers.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 }) {
Expand Down
4 changes: 2 additions & 2 deletions benchmark/http/http_server_for_chunky_client.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand All @@ -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') {
Expand Down
4 changes: 2 additions & 2 deletions benchmark/http/incoming_headers.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 }) {
Expand All @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion benchmark/http/set-header.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
2 changes: 1 addition & 1 deletion benchmark/http/simple.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 }) {
Expand Down
2 changes: 1 addition & 1 deletion benchmark/http/upgrade.js
Original file line number Diff line number Diff line change
Expand Up @@ -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' +
Expand Down

0 comments on commit 4b89ec4

Please sign in to comment.