Skip to content

Commit

Permalink
benchmark: swap var for let in util benchmarks
Browse files Browse the repository at this point in the history
In benchmark util directory this changes for loops using var to let
when it applies for consistency

PR-URL: nodejs#28867
Reviewed-By: Jan Krems <jan.krems@gmail.com>
Reviewed-By: Khaidi Chu <i@2333.moe>
Reviewed-By: Rich Trott <rtrott@gmail.com>
  • Loading branch information
RamirezAlex authored and Trott committed Jul 30, 2019
1 parent 0d1b14a commit d349ba2
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion benchmark/util/format.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion benchmark/util/inspect-proxy.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
2 changes: 1 addition & 1 deletion benchmark/util/inspect.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion benchmark/util/splice-one.js
Original file line number Diff line number Diff line change
Expand Up @@ -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('');
}
Expand Down
2 changes: 1 addition & 1 deletion benchmark/util/type-check.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit d349ba2

Please sign in to comment.