0
0
mirror of https://github.com/nodejs/node.git synced 2024-11-30 07:27:22 +01:00
nodejs/benchmark/http/simple.js
Ruben Bridgewater f86f5736da
benchmark,lib: change var to const
Refs: https://github.com/nodejs/node/pull/26679

PR-URL: https://github.com/nodejs/node/pull/26915
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Refael Ackermann <refack@gmail.com>
2019-03-30 13:16:39 +01:00

27 lines
597 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]
});
function main({ type, len, chunks, c, chunkedEnc, res }) {
const server = require('../fixtures/simple-http-server.js')
.listen(common.PORT)
.on('listening', () => {
const path = `/${type}/${len}/${chunks}/normal/${chunkedEnc}`;
bench.http({
path: path,
connections: c
}, () => {
server.close();
});
});
}