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 <anna@addaleax.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
  • Loading branch information
dnlup authored and targos committed Apr 28, 2020
1 parent 862aeae commit c572218
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
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
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
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 c572218

Please sign in to comment.