2016-02-20 02:03:16 +01:00
|
|
|
'use strict';
|
2017-09-14 03:48:53 +02:00
|
|
|
const common = require('../common.js');
|
2013-02-12 08:43:22 +01:00
|
|
|
|
2017-09-14 03:48:53 +02:00
|
|
|
const bench = common.createBenchmark(main, {
|
2019-03-22 03:44:26 +01:00
|
|
|
// Unicode confuses ab on os x.
|
2013-02-12 08:43:22 +01:00
|
|
|
type: ['bytes', 'buffer'],
|
2017-03-29 17:31:31 +02:00
|
|
|
len: [4, 1024, 102400],
|
2017-06-07 17:25:24 +02:00
|
|
|
chunks: [1, 4],
|
2016-12-31 21:58:14 +01:00
|
|
|
c: [50, 500],
|
2018-01-25 17:09:55 +01:00
|
|
|
chunkedEnc: [1, 0]
|
2013-02-12 08:43:22 +01:00
|
|
|
});
|
|
|
|
|
2017-12-30 03:57:46 +01:00
|
|
|
function main({ type, len, chunks, c, chunkedEnc, res }) {
|
2019-03-26 05:21:27 +01:00
|
|
|
const server = require('../fixtures/simple-http-server.js')
|
2018-01-23 13:18:55 +01:00
|
|
|
.listen(common.PORT)
|
2019-02-05 07:06:08 +01:00
|
|
|
.on('listening', () => {
|
2018-01-25 17:09:55 +01:00
|
|
|
const path = `/${type}/${len}/${chunks}/normal/${chunkedEnc}`;
|
2013-02-12 08:43:22 +01:00
|
|
|
|
2016-08-05 11:34:50 +02:00
|
|
|
bench.http({
|
|
|
|
path: path,
|
2017-12-30 03:57:46 +01:00
|
|
|
connections: c
|
2019-02-05 07:06:08 +01:00
|
|
|
}, () => {
|
2013-02-25 17:30:05 +01:00
|
|
|
server.close();
|
2013-02-12 08:43:22 +01:00
|
|
|
});
|
2017-03-29 17:31:31 +02:00
|
|
|
});
|
2013-02-12 08:43:22 +01:00
|
|
|
}
|