mirror of
https://github.com/nodejs/node.git
synced 2025-05-08 08:02:48 +00:00

PR-URL: https://github.com/nodejs/node/pull/18250 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
21 lines
427 B
JavaScript
21 lines
427 B
JavaScript
'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);
|
|
}
|