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 d469a06

Browse filesBrowse files
joyeecheungMylesBorins
authored andcommitted
benchmark: cut down http benchmark run time
PR-URL: #18379 Reviewed-By: Jon Moss <me@jonathanmoss.me> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
1 parent 4f4bfbe commit d469a06
Copy full SHA for d469a06

File tree

Expand file treeCollapse file tree

3 files changed

+35
-4
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

3 files changed

+35
-4
lines changed
Open diff view settings
Collapse file

‎benchmark/_http-benchmarkers.js‎

Copy file name to clipboardExpand all lines: benchmark/_http-benchmarkers.js
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ exports.run = function(options, callback) {
185185
port: exports.PORT,
186186
path: '/',
187187
connections: 100,
188-
duration: 10,
188+
duration: 5,
189189
benchmarker: exports.default_http_benchmarker
190190
}, options);
191191
if (!options.benchmarker) {
Collapse file

‎benchmark/http/set-header.js‎

Copy file name to clipboard
+32Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
'use strict';
2+
const common = require('../common.js');
3+
const PORT = common.PORT;
4+
5+
const bench = common.createBenchmark(main, {
6+
res: ['normal', 'setHeader', 'setHeaderWH']
7+
});
8+
9+
const type = 'bytes';
10+
const len = 4;
11+
const chunks = 0;
12+
const chunkedEnc = 0;
13+
const c = 50;
14+
15+
// normal: writeHead(status, {...})
16+
// setHeader: statusCode = status, setHeader(...) x2
17+
// setHeaderWH: setHeader(...), writeHead(status, ...)
18+
function main({ res }) {
19+
process.env.PORT = PORT;
20+
var server = require('../fixtures/simple-http-server.js')
21+
.listen(PORT)
22+
.on('listening', function() {
23+
const path = `/${type}/${len}/${chunks}/normal/${chunkedEnc}`;
24+
25+
bench.http({
26+
path: path,
27+
connections: c
28+
}, function() {
29+
server.close();
30+
});
31+
});
32+
}
Collapse file

‎benchmark/http/simple.js‎

Copy file name to clipboardExpand all lines: benchmark/http/simple.js
+2-3Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,14 @@ const bench = common.createBenchmark(main, {
77
len: [4, 1024, 102400],
88
chunks: [1, 4],
99
c: [50, 500],
10-
chunkedEnc: [1, 0],
11-
res: ['normal', 'setHeader', 'setHeaderWH']
10+
chunkedEnc: [1, 0]
1211
});
1312

1413
function main({ type, len, chunks, c, chunkedEnc, res }) {
1514
var server = require('../fixtures/simple-http-server.js')
1615
.listen(common.PORT)
1716
.on('listening', function() {
18-
const path = `/${type}/${len}/${chunks}/${res}/${chunkedEnc}`;
17+
const path = `/${type}/${len}/${chunks}/normal/${chunkedEnc}`;
1918

2019
bench.http({
2120
path: path,

0 commit comments

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