benchmark: swap var for let in util benchmarks

In benchmark util directory this changes for loops using var to let
when it applies for consistency

PR-URL: https://github.com/nodejs/node/pull/28867
Reviewed-By: Jan Krems <jan.krems@gmail.com>
Reviewed-By: Khaidi Chu <i@2333.moe>
Reviewed-By: Rich Trott <rtrott@gmail.com>
This commit is contained in:
Alex Ramirez 2019-07-24 17:24:57 -05:00 committed by Rich Trott
parent 0d1b14ac19
commit d349ba29ef
5 changed files with 5 additions and 5 deletions

View File

@ -25,7 +25,7 @@ function main({ n, type }) {
const [first, second] = inputs[type || 'string'];
bench.start();
for (var i = 0; i < n; i++) {
for (let i = 0; i < n; i++) {
util.format(first, second);
}
bench.end(n);

View File

@ -9,7 +9,7 @@ function main({ n }) {
const proxyA = new Proxy({}, { get: () => {} });
const proxyB = new Proxy(() => {}, {});
bench.start();
for (var i = 0; i < n; i += 1)
for (let i = 0; i < n; i += 1)
util.inspect({ a: proxyA, b: proxyB }, { showProxy: true });
bench.end(n);
}

View File

@ -30,7 +30,7 @@ const bench = common.createBenchmark(main, {
function benchmark(n, obj, options) {
bench.start();
for (var i = 0; i < n; i += 1) {
for (let i = 0; i < n; i += 1) {
util.inspect(obj, options);
}
bench.end(n);

View File

@ -25,7 +25,7 @@ function main({ n, pos, size }) {
}
bench.start();
for (var i = 0; i < n; i++) {
for (let i = 0; i < n; i++) {
spliceOne(arr, index);
arr.push('');
}

View File

@ -45,7 +45,7 @@ function main({ type, argument, version, n }) {
const arg = args[type][argument];
bench.start();
for (var i = 0; i < n; i++) {
for (let i = 0; i < n; i++) {
func(arg);
}
bench.end(n);