Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit bbcf9f0

Browse filesBrowse files
RamirezAlextargos
authored andcommitted
benchmark: swap var for let in buffer benchmarks
In benchmark buffers directory this changes for loops using var to let when it applies for consistency PR-URL: #28867 Reviewed-By: Jan Krems <jan.krems@gmail.com> Reviewed-By: Khaidi Chu <i@2333.moe> Reviewed-By: Rich Trott <rtrott@gmail.com>
1 parent f2c1f36 commit bbcf9f0
Copy full SHA for bbcf9f0
Expand file treeCollapse file tree

18 files changed

+25
-25
lines changed
Open diff view settings
Collapse file

‎benchmark/buffers/buffer-base64-decode-wrapped.js‎

Copy file name to clipboardExpand all lines: benchmark/buffers/buffer-base64-decode-wrapped.js
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ function main({ charsPerLine, linesCount, n }) {
1818
const buffer = Buffer.alloc(bytesCount, line, 'base64');
1919

2020
bench.start();
21-
for (var i = 0; i < n; i++) {
21+
for (let i = 0; i < n; i++) {
2222
buffer.base64Write(data, 0, bytesCount);
2323
}
2424
bench.end(n);
Collapse file

‎benchmark/buffers/buffer-base64-decode.js‎

Copy file name to clipboardExpand all lines: benchmark/buffers/buffer-base64-decode.js
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,6 @@ function main({ n, size }) {
1616
const b = Buffer.allocUnsafe(encodedSize);
1717
b.write(s, 0, encodedSize, 'base64');
1818
bench.start();
19-
for (var i = 0; i < n; i += 1) b.base64Write(s, 0, s.length);
19+
for (let i = 0; i < n; i += 1) b.base64Write(s, 0, s.length);
2020
bench.end(n);
2121
}
Collapse file

‎benchmark/buffers/buffer-bytelength.js‎

Copy file name to clipboardExpand all lines: benchmark/buffers/buffer-bytelength.js
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ function main({ n, len, encoding }) {
3737
}
3838

3939
bench.start();
40-
for (var i = 0; i < n; i++) {
40+
for (let i = 0; i < n; i++) {
4141
const index = n % strings.length;
4242
// Go!
4343
const r = Buffer.byteLength(strings[index], encoding);
Collapse file

‎benchmark/buffers/buffer-compare-offset.js‎

Copy file name to clipboardExpand all lines: benchmark/buffers/buffer-compare-offset.js
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@ const bench = common.createBenchmark(main, {
88
});
99

1010
function compareUsingSlice(b0, b1, len, iter) {
11-
for (var i = 0; i < iter; i++)
11+
for (let i = 0; i < iter; i++)
1212
Buffer.compare(b0.slice(1, len), b1.slice(1, len));
1313
}
1414

1515
function compareUsingOffset(b0, b1, len, iter) {
16-
for (var i = 0; i < iter; i++)
16+
for (let i = 0; i < iter; i++)
1717
b0.compare(b1, 1, len, 1, len);
1818
}
1919

Collapse file

‎benchmark/buffers/buffer-compare.js‎

Copy file name to clipboardExpand all lines: benchmark/buffers/buffer-compare.js
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ function main({ n, size }) {
3434
b1[size - 1] = 'b'.charCodeAt(0);
3535

3636
bench.start();
37-
for (var i = 0; i < n; i++) {
37+
for (let i = 0; i < n; i++) {
3838
Buffer.compare(b0, b1);
3939
}
4040
bench.end(n);
Collapse file

‎benchmark/buffers/buffer-concat.js‎

Copy file name to clipboardExpand all lines: benchmark/buffers/buffer-concat.js
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ function main({ n, pieces, pieceSize, withTotalLength }) {
1515
const totalLength = withTotalLength ? pieces * pieceSize : undefined;
1616

1717
bench.start();
18-
for (var i = 0; i < n; i++) {
18+
for (let i = 0; i < n; i++) {
1919
Buffer.concat(list, totalLength);
2020
}
2121
bench.end(n);
Collapse file

‎benchmark/buffers/buffer-indexof-number.js‎

Copy file name to clipboardExpand all lines: benchmark/buffers/buffer-indexof-number.js
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ function main({ n, value }) {
1515

1616
let count = 0;
1717
bench.start();
18-
for (var i = 0; i < n; i++) {
18+
for (let i = 0; i < n; i++) {
1919
count += aliceBuffer.indexOf(value, 0, undefined);
2020
}
2121
bench.end(n);
Collapse file

‎benchmark/buffers/buffer-indexof.js‎

Copy file name to clipboardExpand all lines: benchmark/buffers/buffer-indexof.js
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ function main({ n, search, encoding, type }) {
4242
}
4343

4444
bench.start();
45-
for (var i = 0; i < n; i++) {
45+
for (let i = 0; i < n; i++) {
4646
aliceBuffer.indexOf(search, 0, encoding);
4747
}
4848
bench.end(n);
Collapse file

‎benchmark/buffers/buffer-normalize-encoding.js‎

Copy file name to clipboardExpand all lines: benchmark/buffers/buffer-normalize-encoding.js
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ function main({ encoding, n }) {
3131
const { normalizeEncoding } = require('internal/util');
3232

3333
bench.start();
34-
for (var i = 0; i < n; i++) {
34+
for (let i = 0; i < n; i++) {
3535
normalizeEncoding(encoding);
3636
}
3737
bench.end(n);
Collapse file

‎benchmark/buffers/buffer-read-float.js‎

Copy file name to clipboardExpand all lines: benchmark/buffers/buffer-read-float.js
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ function main({ n, type, endian, value }) {
3232
buff[`write${type}${endian}`](values[type][value], 0);
3333

3434
bench.start();
35-
for (var i = 0; i !== n; i++) {
35+
for (let i = 0; i !== n; i++) {
3636
buff[fn](0);
3737
}
3838
bench.end(n);

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.