node/benchmark/http/simple.js
Antoine du Hamel 5c74108891
benchmark: add trailing commas in benchmark/http
PR-URL: https://github.com/nodejs/node/pull/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>
2023-02-12 16:32:00 +00:00

30 lines
654 B
JavaScript

'use strict';
const common = require('../common.js');
const bench = common.createBenchmark(main, {
// Unicode confuses ab on os x.
type: ['bytes', 'buffer'],
len: [4, 1024, 102400],
chunks: [1, 4],
c: [50, 500],
chunkedEnc: [1, 0],
duration: 5,
});
function main({ type, len, chunks, c, chunkedEnc, duration }) {
const server = require('../fixtures/simple-http-server.js')
.listen(0)
.on('listening', () => {
const path = `/${type}/${len}/${chunks}/normal/${chunkedEnc}`;
bench.http({
path,
connections: c,
duration,
port: server.address().port,
}, () => {
server.close();
});
});
}