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

PR-URL: https://github.com/nodejs/node/pull/13757 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de>
23 lines
468 B
JavaScript
23 lines
468 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(conf) {
|
|
const len = +conf.len;
|
|
const n = +conf.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);
|
|
}
|