aboutsummaryrefslogtreecommitdiff
path: root/benchmark/http/set_header.js
blob: 22de61b3f847a3bba11fa2af19c9a0e92da96245 (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
27
28
29
30
'use strict';

const common = require('../common.js');
const { OutgoingMessage } = require('_http_outgoing');

const bench = common.createBenchmark(main, {
  value: [
    'X-Powered-By',
    'Vary',
    'Set-Cookie',
    'Content-Type',
    'Content-Length',
    'Connection',
    'Transfer-Encoding'
  ],
  n: [1e6],
});

function main(conf) {
  const n = +conf.n;
  const value = conf.value;

  const og = new OutgoingMessage();

  bench.start();
  for (var i = 0; i < n; i++) {
    og.setHeader(value, '');
  }
  bench.end(n);
}