summaryrefslogtreecommitdiff
path: root/benchmark/http/simple.js
blob: 95409faa9a869ccd9d1d014b23d55b9c19465625 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
'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();
    });
  });
}