node/benchmark/http/simple.js
Anatoli Papirovski cbd0be59f0
benchmark: fix http/simple.js benchmark
autocannon appears to have trouble recognizing URLs that contain true
or false within them. Use 0 or 1 instead to represent the same.

PR-URL: https://github.com/nodejs/node/pull/17583
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
2017-12-12 03:28:40 -05:00

30 lines
697 B
JavaScript

'use strict';
const common = require('../common.js');
const PORT = common.PORT;
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],
res: ['normal', 'setHeader', 'setHeaderWH']
});
function main(conf) {
process.env.PORT = PORT;
var server = require('../fixtures/simple-http-server.js')
.listen(PORT)
.on('listening', function() {
const path =
`/${conf.type}/${conf.len}/${conf.chunks}/${conf.res}/${conf.chunkedEnc}`;
bench.http({
path: path,
connections: conf.c
}, function() {
server.close();
});
});
}