summaryrefslogtreecommitdiff
path: root/benchmark
diff options
context:
space:
mode:
authorAlex Ramirez <alexander.ramirez@gmail.com>2019-07-20 20:45:18 -0500
committerRich Trott <rtrott@gmail.com>2019-07-30 15:20:08 -0700
commit9140f62c22e7bd7ab04b283921cde0c320174d71 (patch)
treeee8707de7458bb97bed578bc3a7f566dfa22ef00 /benchmark
parentfd9e0f72abd8b7712ba504596acd2fdcc04611f9 (diff)
downloadandroid-node-v8-9140f62c22e7bd7ab04b283921cde0c320174d71.tar.gz
android-node-v8-9140f62c22e7bd7ab04b283921cde0c320174d71.tar.bz2
android-node-v8-9140f62c22e7bd7ab04b283921cde0c320174d71.zip
benchmark, http: refactor for code consistency
In benchmark http directory this changes for loops using var to let when it applies for consistency PR-URL: https://github.com/nodejs/node/pull/28791 Reviewed-By: Rich Trott <rtrott@gmail.com>
Diffstat (limited to 'benchmark')
-rw-r--r--benchmark/http/bench-parser.js4
-rw-r--r--benchmark/http/check_invalid_header_char.js2
-rw-r--r--benchmark/http/check_is_http_token.js2
-rw-r--r--benchmark/http/set_header.js2
4 files changed, 5 insertions, 5 deletions
diff --git a/benchmark/http/bench-parser.js b/benchmark/http/bench-parser.js
index 05776f2d8a..e514ce7e75 100644
--- a/benchmark/http/bench-parser.js
+++ b/benchmark/http/bench-parser.js
@@ -22,7 +22,7 @@ function main({ len, n }) {
const parser = newParser(REQUEST);
bench.start();
- for (var i = 0; i < n; i++) {
+ for (let i = 0; i < n; i++) {
parser.execute(header, 0, header.length);
parser.initialize(REQUEST, {});
}
@@ -45,7 +45,7 @@ function main({ len, n }) {
let header = `GET /hello HTTP/1.1${CRLF}Content-Type: text/plain${CRLF}`;
- for (var i = 0; i < len; i++) {
+ for (let i = 0; i < len; i++) {
header += `X-Filler${i}: ${Math.random().toString(36).substr(2)}${CRLF}`;
}
header += CRLF;
diff --git a/benchmark/http/check_invalid_header_char.js b/benchmark/http/check_invalid_header_char.js
index 46ca9f3d73..245dc6fb8e 100644
--- a/benchmark/http/check_invalid_header_char.js
+++ b/benchmark/http/check_invalid_header_char.js
@@ -61,7 +61,7 @@ function main({ n, input }) {
const len = inputs.length;
bench.start();
- for (var i = 0; i < n; i++) {
+ for (let i = 0; i < n; i++) {
_checkInvalidHeaderChar(inputs[i % len]);
}
bench.end(n);
diff --git a/benchmark/http/check_is_http_token.js b/benchmark/http/check_is_http_token.js
index eab075249e..2137a73e54 100644
--- a/benchmark/http/check_is_http_token.js
+++ b/benchmark/http/check_is_http_token.js
@@ -42,7 +42,7 @@ const bench = common.createBenchmark(main, {
function main({ n, key }) {
bench.start();
- for (var i = 0; i < n; i++) {
+ for (let i = 0; i < n; i++) {
_checkIsHttpToken(key);
}
bench.end(n);
diff --git a/benchmark/http/set_header.js b/benchmark/http/set_header.js
index 4129e4fee0..470d4b0081 100644
--- a/benchmark/http/set_header.js
+++ b/benchmark/http/set_header.js
@@ -23,7 +23,7 @@ function main(conf) {
const og = new OutgoingMessage();
bench.start();
- for (var i = 0; i < n; i++) {
+ for (let i = 0; i < n; i++) {
og.setHeader(value, '');
}
bench.end(n);