GeezerVison is showing github.com — benchmark: refactor for consistent style · moander/node@29e74d4
File treeExpand file treeCollapse file tree Open diff view settings Some content is hiddenLarge Commits have some content hidden by default. Use the searchbox below for content that may be hidden. Dismiss bannerExpand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: benchmark/_cli.js +2-4Lines changed: 2 additions & 4 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -6,10 +6,8 @@ const path = require('path'); | 6 | 6 | // Create an object of all benchmark scripts | 7 | 7 | const benchmarks = {}; | 8 | 8 | 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) => { | 13 | 11 | benchmarks[category] = fs.readdirSync(path.resolve(__dirname, category)) | 14 | 12 | .filter((filename) => filename[0] !== '.' && filename[0] !== '_'); | 15 | 13 | }); | |
Collapse file Copy file name to clipboardExpand all lines: benchmark/buffers/buffer-bytelength.js +2-4Lines changed: 2 additions & 4 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -12,7 +12,7 @@ const chars = [ | 12 | 12 | 'hello brendan!!!', // 1 byte | 13 | 13 | 'ΰαβγδεζηθικλμνξο', // 2 bytes | 14 | 14 | '挰挱挲挳挴挵挶挷挸挹挺挻挼挽挾挿', // 3 bytes | 15 | | - '𠜎𠜱𠝹𠱓𠱸𠲖𠳏𠳕𠴕𠵼𠵿𠸎𠸏𠹷𠺝𠺢' // 4 bytes | | 15 | + '𠜎𠜱𠝹𠱓𠱸𠲖𠳏𠳕𠴕𠵼𠵿𠸎𠸏𠹷𠺝𠺢', // 4 bytes | 16 | 16 | ]; | 17 | 17 |
| 18 | 18 | function main({ n, len, encoding }) { | @@ -33,9 +33,7 @@ function main({ n, len, encoding }) { | 33 | 33 | } | 34 | 34 |
| 35 | 35 | // 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)); | 39 | 37 | } | 40 | 38 |
| 41 | 39 | bench.start(); | |
Collapse file Copy file name to clipboardExpand all lines: benchmark/buffers/buffer-fill.js +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -12,7 +12,7 @@ const bench = common.createBenchmark(main, { | 12 | 12 | 'fill("t", "utf8")', | 13 | 13 | 'fill("t", 0, "utf8")', | 14 | 14 | 'fill("t", 0)', | 15 | | - 'fill(Buffer.alloc(1), 0)' | | 15 | + 'fill(Buffer.alloc(1), 0)', | 16 | 16 | ], | 17 | 17 | size: [2 ** 8, 2 ** 13, 2 ** 16], | 18 | 18 | n: [2e4] | |
Collapse file Copy file name to clipboardExpand all lines: benchmark/buffers/buffer-from.js +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -12,7 +12,7 @@ const bench = common.createBenchmark(main, { | 12 | 12 | 'string', | 13 | 13 | 'string-utf8', | 14 | 14 | 'string-base64', | 15 | | - 'object' | | 15 | + 'object', | 16 | 16 | ], | 17 | 17 | len: [10, 2048], | 18 | 18 | n: [2048] | |
Collapse file Copy file name to clipboardExpand all lines: benchmark/buffers/buffer-indexof.js +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -18,7 +18,7 @@ const searchStrings = [ | 18 | 18 | 'Soo--oop', | 19 | 19 | 'aaaaaaaaaaaaaaaaa', | 20 | 20 | 'venture to go near the house till she had brought herself down to', | 21 | | - '</i> to the Caterpillar' | | 21 | + '</i> to the Caterpillar', | 22 | 22 | ]; | 23 | 23 |
| 24 | 24 | const bench = common.createBenchmark(main, { | |
Collapse file Copy file name to clipboardExpand all lines: benchmark/buffers/buffer-normalize-encoding.js +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -25,7 +25,7 @@ const bench = common.createBenchmark(main, { | 25 | 25 | 'utf16le', | 26 | 26 | 'UTF16LE', | 27 | 27 | 'utf8', | 28 | | - 'UTF8' | | 28 | + 'UTF8', | 29 | 29 | ], | 30 | 30 | n: [1e6] | 31 | 31 | }, { | |
Collapse file Copy file name to clipboardExpand all lines: benchmark/buffers/buffer-read-with-byteLength.js +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -5,7 +5,7 @@ const types = [ | 5 | 5 | 'IntBE', | 6 | 6 | 'IntLE', | 7 | 7 | 'UIntBE', | 8 | | - 'UIntLE' | | 8 | + 'UIntLE', | 9 | 9 | ]; | 10 | 10 |
| 11 | 11 | const bench = common.createBenchmark(main, { | |
Collapse file Copy file name to clipboardExpand all lines: benchmark/buffers/buffer-read.js +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -15,7 +15,7 @@ const types = [ | 15 | 15 | 'FloatLE', | 16 | 16 | 'FloatBE', | 17 | 17 | 'DoubleLE', | 18 | | - 'DoubleBE' | | 18 | + 'DoubleBE', | 19 | 19 | ]; | 20 | 20 |
| 21 | 21 | const bench = common.createBenchmark(main, { | |
Collapse file Copy file name to clipboardExpand all lines: benchmark/buffers/buffer-write-string.js +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
| 3 | 3 | const common = require('../common.js'); | 4 | 4 | const bench = common.createBenchmark(main, { | 5 | 5 | encoding: [ | 6 | | - '', 'utf8', 'ascii', 'hex', 'UCS-2', 'utf16le', 'latin1', 'binary' | | 6 | + '', 'utf8', 'ascii', 'hex', 'UCS-2', 'utf16le', 'latin1', 'binary', | 7 | 7 | ], | 8 | 8 | args: [ '', 'offset', 'offset+length' ], | 9 | 9 | len: [10, 2048], | |
Collapse file Copy file name to clipboardExpand all lines: benchmark/buffers/buffer-write.js +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -19,7 +19,7 @@ const types = [ | 19 | 19 | 'FloatLE', | 20 | 20 | 'FloatBE', | 21 | 21 | 'DoubleLE', | 22 | | - 'DoubleBE' | | 22 | + 'DoubleBE', | 23 | 23 | ]; | 24 | 24 |
| 25 | 25 | const bench = common.createBenchmark(main, { | |
|