mirror of
https://github.com/nodejs/node.git
synced 2025-05-02 14:56:19 +00:00

Code in benchmark directory sometimes uses `function () {}` for anonymous callbacks and sometimes uses `() => {}`. Multi-line arrays sometimes have a trailing comma and sometimes do not. Update to always use arrow functions for anonymous callbacks and trailing commas for multiline arrays. PR-URL: https://github.com/nodejs/node/pull/25944 Reviewed-By: Anto Aravinth <anto.aravinth.cse@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
33 lines
745 B
JavaScript
33 lines
745 B
JavaScript
'use strict';
|
|
const common = require('../common.js');
|
|
const PORT = common.PORT;
|
|
|
|
const bench = common.createBenchmark(main, {
|
|
res: ['normal', 'setHeader', 'setHeaderWH']
|
|
});
|
|
|
|
const type = 'bytes';
|
|
const len = 4;
|
|
const chunks = 0;
|
|
const chunkedEnc = 0;
|
|
const c = 50;
|
|
|
|
// normal: writeHead(status, {...})
|
|
// setHeader: statusCode = status, setHeader(...) x2
|
|
// setHeaderWH: setHeader(...), writeHead(status, ...)
|
|
function main({ res }) {
|
|
process.env.PORT = PORT;
|
|
var server = require('../fixtures/simple-http-server.js')
|
|
.listen(PORT)
|
|
.on('listening', () => {
|
|
const path = `/${type}/${len}/${chunks}/normal/${chunkedEnc}`;
|
|
|
|
bench.http({
|
|
path: path,
|
|
connections: c
|
|
}, () => {
|
|
server.close();
|
|
});
|
|
});
|
|
}
|