Skip to content

Commit c4d16e8

Browse files
Trottaddaleax
authored andcommittedFeb 7, 2019
benchmark: refactor for consistent style
Code in benchmark directory sometimes uses `function () {}` for anonymous callbacks and sometimes uses `() => {}`. Multi-line arrays sometimes have a trailing comma and sometimes do not. Update to always use arrow functions for anonymous callbacks and trailing commas for multiline arrays. PR-URL: #25944 Reviewed-By: Anto Aravinth <anto.aravinth.cse@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
1 parent 2d57504 commit c4d16e8

File tree

96 files changed

+158
-164
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

96 files changed

+158
-164
lines changed
 

‎benchmark/_cli.js

+2-4
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,8 @@ const path = require('path');
66
// Create an object of all benchmark scripts
77
const benchmarks = {};
88
fs.readdirSync(__dirname)
9-
.filter(function(name) {
10-
return fs.statSync(path.resolve(__dirname, name)).isDirectory();
11-
})
12-
.forEach(function(category) {
9+
.filter((name) => fs.statSync(path.resolve(__dirname, name)).isDirectory())
10+
.forEach((category) => {
1311
benchmarks[category] = fs.readdirSync(path.resolve(__dirname, category))
1412
.filter((filename) => filename[0] !== '.' && filename[0] !== '_');
1513
});

‎benchmark/buffers/buffer-bytelength.js

+2-4
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ const chars = [
1212
'hello brendan!!!', // 1 byte
1313
'ΰαβγδεζηθικλμνξο', // 2 bytes
1414
'挰挱挲挳挴挵挶挷挸挹挺挻挼挽挾挿', // 3 bytes
15-
'𠜎𠜱𠝹𠱓𠱸𠲖𠳏𠳕𠴕𠵼𠵿𠸎𠸏𠹷𠺝𠺢' // 4 bytes
15+
'𠜎𠜱𠝹𠱓𠱸𠲖𠳏𠳕𠴕𠵼𠵿𠸎𠸏𠹷𠺝𠺢', // 4 bytes
1616
];
1717

1818
function main({ n, len, encoding }) {
@@ -33,9 +33,7 @@ function main({ n, len, encoding }) {
3333
}
3434

3535
// Check the result to ensure it is *properly* optimized
36-
results = strings.map(function(val) {
37-
return Buffer.byteLength(val, encoding);
38-
});
36+
results = strings.map((val) => Buffer.byteLength(val, encoding));
3937
}
4038

4139
bench.start();

0 commit comments

Comments
 (0)