Skip to content

Commit

Permalink
benchmark: use let instead of var in util
Browse files Browse the repository at this point in the history
PR-URL: #31794
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Ruben Bridgewater <[email protected]>
Reviewed-By: Trivikram Kamat <[email protected]>
  • Loading branch information
dnlup authored and addaleax committed Mar 30, 2020
1 parent 148df0a commit f1d3fb0
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions benchmark/util/inspect-array.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ const bench = common.createBenchmark(main, {
});

function main({ n, len, type }) {
var arr = Array(len);
var i, opts;
let arr = Array(len);
let opts;

switch (type) {
case 'denseArray_showHidden':
Expand All @@ -29,14 +29,14 @@ function main({ n, len, type }) {
case 'sparseArray':
break;
case 'mixedArray':
for (i = 0; i < n; i += 2)
for (let i = 0; i < n; i += 2)
arr[i] = i;
break;
default:
throw new Error(`Unsupported type ${type}`);
}
bench.start();
for (i = 0; i < n; i++) {
for (let i = 0; i < n; i++) {
util.inspect(arr, opts);
}
bench.end(n);
Expand Down
2 changes: 1 addition & 1 deletion benchmark/util/inspect.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ function benchmark(n, obj, options) {
}

function main({ method, n, option }) {
var obj;
let obj;
const options = opts[option];
switch (method) {
case 'Object':
Expand Down
6 changes: 3 additions & 3 deletions benchmark/util/normalize-encoding.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,11 @@ function getInput(input) {
function main({ input, n }) {
const { normalizeEncoding } = require('internal/util');
const inputs = getInput(input);
var noDead = '';
let noDead = '';

bench.start();
for (var i = 0; i < n; ++i) {
for (var j = 0; j < inputs.length; ++j) {
for (let i = 0; i < n; ++i) {
for (let j = 0; j < inputs.length; ++j) {
noDead = normalizeEncoding(inputs[j]);
}
}
Expand Down

0 comments on commit f1d3fb0

Please sign in to comment.