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 28156e1

Browse filesBrowse files
BridgeARMylesBorins
authored andcommitted
benchmark: (http(2)) refactor
PR-URL: #18320 Reviewed-By: James M Snell <jasnell@gmail.com>
1 parent 076b3d9 commit 28156e1
Copy full SHA for 28156e1

File tree

Expand file treeCollapse file tree

6 files changed

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

6 files changed

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

‎benchmark/http/bench-parser.js‎

Copy file name to clipboardExpand all lines: benchmark/http/bench-parser.js
-3Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ const bench = common.createBenchmark(main, {
1414
n: [1e5],
1515
});
1616

17-
1817
function main({ len, n }) {
1918
var header = `GET /hello HTTP/1.1${CRLF}Content-Type: text/plain${CRLF}`;
2019

@@ -26,7 +25,6 @@ function main({ len, n }) {
2625
processHeader(Buffer.from(header), n);
2726
}
2827

29-
3028
function processHeader(header, n) {
3129
const parser = newParser(REQUEST);
3230

@@ -38,7 +36,6 @@ function processHeader(header, n) {
3836
bench.end(n);
3937
}
4038

41-
4239
function newParser(type) {
4340
const parser = new HTTPParser(type);
4441

Collapse file

‎benchmark/http/simple.js‎

Copy file name to clipboardExpand all lines: benchmark/http/simple.js
+1-3Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
'use strict';
22
const common = require('../common.js');
3-
const PORT = common.PORT;
43

54
const bench = common.createBenchmark(main, {
65
// unicode confuses ab on os x.
@@ -13,9 +12,8 @@ const bench = common.createBenchmark(main, {
1312
});
1413

1514
function main({ type, len, chunks, c, chunkedEnc, res }) {
16-
process.env.PORT = PORT;
1715
var server = require('../fixtures/simple-http-server.js')
18-
.listen(PORT)
16+
.listen(common.PORT)
1917
.on('listening', function() {
2018
const path = `/${type}/${len}/${chunks}/${res}/${chunkedEnc}`;
2119

Collapse file

‎benchmark/http/upgrade.js‎

Copy file name to clipboardExpand all lines: benchmark/http/upgrade.js
-2Lines changed: 0 additions & 2 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
const net = require('net');
65

76
const bench = common.createBenchmark(main, {
@@ -20,7 +19,6 @@ const resData = 'HTTP/1.1 101 Web Socket Protocol Handshake\r\n' +
2019
'\r\n\r\n';
2120

2221
function main({ n }) {
23-
process.env.PORT = PORT;
2422
var server = require('../fixtures/simple-http-server.js')
2523
.listen(common.PORT)
2624
.on('listening', function() {
Collapse file

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

Copy file name to clipboardExpand all lines: benchmark/http2/respond-with-fd.js
+1-2Lines changed: 1 addition & 2 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
const path = require('path');
65
const fs = require('fs');
76

@@ -25,7 +24,7 @@ function main({ requests, streams, clients }) {
2524
stream.respondWithFD(fd);
2625
stream.on('error', (err) => {});
2726
});
28-
server.listen(PORT, () => {
27+
server.listen(common.PORT, () => {
2928
bench.http({
3029
path: '/',
3130
requests,
Collapse file

‎benchmark/http2/simple.js‎

Copy file name to clipboardExpand all lines: benchmark/http2/simple.js
+1-4Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,8 @@
11
'use strict';
22

33
const common = require('../common.js');
4-
const PORT = common.PORT;
5-
64
const path = require('path');
75
const fs = require('fs');
8-
96
const file = path.join(path.resolve(__dirname, '../fixtures'), 'alice.html');
107

118
const bench = common.createBenchmark(main, {
@@ -24,7 +21,7 @@ function main({ requests, streams, clients }) {
2421
out.pipe(stream);
2522
stream.on('error', (err) => {});
2623
});
27-
server.listen(PORT, () => {
24+
server.listen(common.PORT, () => {
2825
bench.http({
2926
path: '/',
3027
requests,
Collapse file

‎benchmark/http2/write.js‎

Copy file name to clipboardExpand all lines: benchmark/http2/write.js
+1-2Lines changed: 1 addition & 2 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
streams: [100, 200, 1000],
@@ -26,7 +25,7 @@ function main({ streams, length, size }) {
2625
}
2726
write();
2827
});
29-
server.listen(PORT, () => {
28+
server.listen(common.PORT, () => {
3029
bench.http({
3130
path: '/',
3231
requests: 10000,

0 commit comments

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