mirror of
https://github.com/nodejs/node.git
synced 2024-11-21 10:59:27 +00:00
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:
parent
fd9e0f72ab
commit
9140f62c22
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user