• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1'use strict';
2const common = require('../common.js');
3
4const bench = common.createBenchmark(main, {
5  // Unicode confuses ab on os x.
6  type: ['bytes', 'buffer'],
7  len: [4, 1024, 102400],
8  chunks: [1, 4],
9  c: [50, 500],
10  chunkedEnc: [1, 0],
11  duration: 5,
12});
13
14function main({ type, len, chunks, c, chunkedEnc, duration }) {
15  const server = require('../fixtures/simple-http-server.js')
16  .listen(0)
17  .on('listening', () => {
18    const path = `/${type}/${len}/${chunks}/normal/${chunkedEnc}`;
19
20    bench.http({
21      path,
22      connections: c,
23      duration,
24      port: server.address().port,
25    }, () => {
26      server.close();
27    });
28  });
29}
30