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>
This commit is contained in:
Alex Ramirez 2019-07-20 20:45:18 -05:00 committed by Rich Trott
parent fd9e0f72ab
commit 9140f62c22
4 changed files with 5 additions and 5 deletions

View File

@ -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;

View File

@ -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);

View File

@ -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);

View File

@ -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);