Welcome to mirror list, hosted at ThFree Co, Russian Federation.

set_header.js « http « benchmark - github.com/nodejs/node.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: f2236696f1c7df694302f299906801d1e82c4715 (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
'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({ n, value }) {
  const og = new OutgoingMessage();

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