Skip to content
Permalink
Browse files

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: #28791
Reviewed-By: Rich Trott <rtrott@gmail.com>
  • Loading branch information...
RamirezAlex authored and targos committed Jul 21, 2019
1 parent 470db47 commit 391fe463781c776cd73c25b4cd52070e62bc6599
@@ -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;
@@ -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);
@@ -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);
@@ -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);

0 comments on commit 391fe46

Please sign in to comment.
You can’t perform that action at this time.