Skip to content

Commit

Permalink
benchmark, http: refactor for code consistency
Browse files Browse the repository at this point in the history
In benchmark http directory this changes for loops using var to let
when it applies for consistency
  • Loading branch information
RamirezAlex committed Jul 21, 2019
1 parent 49144ab commit db9f71b
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions benchmark/http/bench-parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -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, {});
}
Expand All @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion benchmark/http/check_invalid_header_char.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion benchmark/http/check_is_http_token.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion benchmark/http/set_header.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit db9f71b

Please sign in to comment.