summaryrefslogtreecommitdiff
path: root/benchmark/http/create-clientrequest.js
blob: 97316a7e800419cc1df5b0cfe0ca97d20eed537f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
'use strict';

const common = require('../common.js');
const ClientRequest = require('http').ClientRequest;

const bench = common.createBenchmark(main, {
  len: [1, 8, 16, 32, 64, 128],
  n: [1e6]
});

function main({ len, n }) {
  const path = '/'.repeat(len);
  const opts = { path: path, createConnection: function() {} };

  bench.start();
  for (var i = 0; i < n; i++) {
    new ClientRequest(opts);
  }
  bench.end(n);
}