summaryrefslogtreecommitdiff
path: root/benchmark/http
diff options
context:
space:
mode:
authorRuben Bridgewater <ruben@bridgewater.de>2018-01-23 13:18:55 +0100
committerRuben Bridgewater <ruben@bridgewater.de>2018-02-01 10:49:03 +0100
commit1178670cca16a268162aaf39afeb933779988d22 (patch)
treea3773ace6931745c032dd32a55309d7f43e9a5de /benchmark/http
parent2072f343ad5c7f8a74e480c625b5b4df3d071bf1 (diff)
downloadandroid-node-v8-1178670cca16a268162aaf39afeb933779988d22.tar.gz
android-node-v8-1178670cca16a268162aaf39afeb933779988d22.tar.bz2
android-node-v8-1178670cca16a268162aaf39afeb933779988d22.zip
benchmark: (http(2)) refactor
PR-URL: https://github.com/nodejs/node/pull/18320 Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'benchmark/http')
-rw-r--r--benchmark/http/bench-parser.js3
-rw-r--r--benchmark/http/simple.js4
-rw-r--r--benchmark/http/upgrade.js2
3 files changed, 1 insertions, 8 deletions
diff --git a/benchmark/http/bench-parser.js b/benchmark/http/bench-parser.js
index 4c691d7134..d629fe67e5 100644
--- a/benchmark/http/bench-parser.js
+++ b/benchmark/http/bench-parser.js
@@ -14,7 +14,6 @@ const bench = common.createBenchmark(main, {
n: [1e5],
});
-
function main({ len, n }) {
var header = `GET /hello HTTP/1.1${CRLF}Content-Type: text/plain${CRLF}`;
@@ -26,7 +25,6 @@ function main({ len, n }) {
processHeader(Buffer.from(header), n);
}
-
function processHeader(header, n) {
const parser = newParser(REQUEST);
@@ -38,7 +36,6 @@ function processHeader(header, n) {
bench.end(n);
}
-
function newParser(type) {
const parser = new HTTPParser(type);
diff --git a/benchmark/http/simple.js b/benchmark/http/simple.js
index d5351815fc..bbc59a341d 100644
--- a/benchmark/http/simple.js
+++ b/benchmark/http/simple.js
@@ -1,6 +1,5 @@
'use strict';
const common = require('../common.js');
-const PORT = common.PORT;
const bench = common.createBenchmark(main, {
// unicode confuses ab on os x.
@@ -13,9 +12,8 @@ const bench = common.createBenchmark(main, {
});
function main({ type, len, chunks, c, chunkedEnc, res }) {
- process.env.PORT = PORT;
var server = require('../fixtures/simple-http-server.js')
- .listen(PORT)
+ .listen(common.PORT)
.on('listening', function() {
const path = `/${type}/${len}/${chunks}/${res}/${chunkedEnc}`;
diff --git a/benchmark/http/upgrade.js b/benchmark/http/upgrade.js
index 0feaecc8ff..6b39323396 100644
--- a/benchmark/http/upgrade.js
+++ b/benchmark/http/upgrade.js
@@ -1,7 +1,6 @@
'use strict';
const common = require('../common.js');
-const PORT = common.PORT;
const net = require('net');
const bench = common.createBenchmark(main, {
@@ -20,7 +19,6 @@ const resData = 'HTTP/1.1 101 Web Socket Protocol Handshake\r\n' +
'\r\n\r\n';
function main({ n }) {
- process.env.PORT = PORT;
var server = require('../fixtures/simple-http-server.js')
.listen(common.PORT)
.on('listening', function() {