Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit be24cc0

Browse filesBrowse files
committed
benchmark: add ClientRequest creation benchmark
PR-URL: #10654 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Fedor Indutny <fedor.indutny@gmail.com>
1 parent 5059b76 commit be24cc0
Copy full SHA for be24cc0

File tree

Expand file treeCollapse file tree

1 file changed

+23
-0
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+23
-0
lines changed
Open diff view settings
Collapse file
+23Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
'use strict';
2+
3+
var common = require('../common.js');
4+
var ClientRequest = require('http').ClientRequest;
5+
6+
var bench = common.createBenchmark(main, {
7+
pathlen: [1, 8, 16, 32, 64, 128],
8+
n: [1e6]
9+
});
10+
11+
function main(conf) {
12+
var pathlen = +conf.pathlen;
13+
var n = +conf.n;
14+
15+
var path = '/'.repeat(pathlen);
16+
var opts = { path: path, createConnection: function() {} };
17+
18+
bench.start();
19+
for (var i = 0; i < n; i++) {
20+
new ClientRequest(opts);
21+
}
22+
bench.end(n);
23+
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.