0
0
mirror of https://github.com/nodejs/node.git synced 2024-12-01 16:10:02 +01:00
nodejs/benchmark/http/simple.js
Joyee Cheung 54b3a685c1
benchmark: cut down http benchmark run time
PR-URL: https://github.com/nodejs/node/pull/18379
Reviewed-By: Jon Moss <me@jonathanmoss.me>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2018-02-01 11:43:30 +01:00

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