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 3ca7a78

Browse filesBrowse files
Trottdanielleadams
authored andcommitted
benchmark: fix http2 benchmarks
Fixes: #36746 PR-URL: #36871 Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
1 parent cb0b53e commit 3ca7a78
Copy full SHA for 3ca7a78

File tree

Expand file treeCollapse file tree

6 files changed

+11
-8
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

6 files changed

+11
-8
lines changed
Open diff view settings
Collapse file

‎benchmark/_test-double-benchmarker.js‎

Copy file name to clipboardExpand all lines: benchmark/_test-double-benchmarker.js
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ function run() {
4646
}
4747
} else { // HTTP/2
4848
const client = http.connect(url);
49-
client.on('error', (e) => { throw e; });
49+
client.on('error', () => {});
5050
request(client.request(), client);
5151
}
5252
}
Collapse file

‎benchmark/http2/compat.js‎

Copy file name to clipboardExpand all lines: benchmark/http2/compat.js
+2-1Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,10 @@ function main({ requests, streams, clients, duration }) {
2424
res.destroy();
2525
});
2626
});
27-
server.listen(common.PORT, () => {
27+
server.listen(0, () => {
2828
bench.http({
2929
path: '/',
30+
port: server.address().port,
3031
requests,
3132
maxConcurrentStreams: streams,
3233
clients,
Collapse file

‎benchmark/http2/headers.js‎

Copy file name to clipboardExpand all lines: benchmark/http2/headers.js
+2-3Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
'use strict';
22

33
const common = require('../common.js');
4-
const PORT = common.PORT;
54

65
const bench = common.createBenchmark(main, {
76
n: [1e3],
@@ -32,8 +31,8 @@ function main({ n, nheaders }) {
3231
stream.respond();
3332
stream.end('Hi!');
3433
});
35-
server.listen(PORT, () => {
36-
const client = http2.connect(`http://localhost:${PORT}/`, {
34+
server.listen(0, () => {
35+
const client = http2.connect(`http://localhost:${server.address().port}/`, {
3736
maxHeaderListPairs: 20000
3837
});
3938

Collapse file

‎benchmark/http2/respond-with-fd.js‎

Copy file name to clipboardExpand all lines: benchmark/http2/respond-with-fd.js
+2-1Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,11 @@ function main({ requests, streams, clients, duration }) {
2525
stream.respondWithFD(fd);
2626
stream.on('error', (err) => {});
2727
});
28-
server.listen(common.PORT, () => {
28+
server.listen(0, () => {
2929
bench.http({
3030
path: '/',
3131
requests,
32+
port: server.address().port,
3233
maxConcurrentStreams: streams,
3334
clients,
3435
duration,
Collapse file

‎benchmark/http2/simple.js‎

Copy file name to clipboardExpand all lines: benchmark/http2/simple.js
+2-1Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,10 @@ function main({ requests, streams, clients, duration }) {
2222
out.pipe(stream);
2323
stream.on('error', (err) => {});
2424
});
25-
server.listen(common.PORT, () => {
25+
server.listen(0, () => {
2626
bench.http({
2727
path: '/',
28+
port: server.address().port,
2829
requests,
2930
maxConcurrentStreams: streams,
3031
clients,
Collapse file

‎benchmark/http2/write.js‎

Copy file name to clipboardExpand all lines: benchmark/http2/write.js
+2-1Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,10 @@ function main({ streams, length, size, duration }) {
2626
}
2727
write();
2828
});
29-
server.listen(common.PORT, () => {
29+
server.listen(0, () => {
3030
bench.http({
3131
path: '/',
32+
port: server.address().port,
3233
requests: 10000,
3334
duration,
3435
maxConcurrentStreams: streams,

0 commit comments

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