GeezerVison is showing github.com — benchmark: fix buffer option in buffer read/write benchmarks · nodejs/node@cbd6913
File treeExpand file treeCollapse file tree Open diff view settings Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: benchmark/buffers/buffer-read-with-byteLength.js +4-4Lines changed: 4 additions & 4 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -10,14 +10,14 @@ const types = [ | 10 | 10 | ]; | 11 | 11 |
| 12 | 12 | const bench = common.createBenchmark(main, { | 13 | | - buffer: ['fast'], | | 13 | + buffer: ['fast', 'slow'], | 14 | 14 | type: types, | 15 | 15 | n: [1e6], | 16 | | - byteLength: [1, 2, 3, 4, 5, 6], | | 16 | + byteLength: [1, 2, 4, 6], | 17 | 17 | }); | 18 | 18 |
| 19 | | -function main({ n, buf, type, byteLength }) { | 20 | | - const buff = buf === 'fast' ? | | 19 | +function main({ n, buffer, type, byteLength }) { | | 20 | + const buff = buffer === 'fast' ? | 21 | 21 | Buffer.alloc(8) : | 22 | 22 | Buffer.allocUnsafeSlow(8); | 23 | 23 | const fn = `read${type}`; | |
Collapse file Copy file name to clipboardExpand all lines: benchmark/buffers/buffer-read.js +3-3Lines changed: 3 additions & 3 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -20,13 +20,13 @@ const types = [ | 20 | 20 | ]; | 21 | 21 |
| 22 | 22 | const bench = common.createBenchmark(main, { | 23 | | - buffer: ['fast'], | | 23 | + buffer: ['fast', 'slow'], | 24 | 24 | type: types, | 25 | 25 | n: [1e6], | 26 | 26 | }); | 27 | 27 |
| 28 | | -function main({ n, buf, type }) { | 29 | | - const buff = buf === 'fast' ? | | 28 | +function main({ n, buffer, type }) { | | 29 | + const buff = buffer === 'fast' ? | 30 | 30 | Buffer.alloc(8) : | 31 | 31 | Buffer.allocUnsafeSlow(8); | 32 | 32 | const fn = `read${type}`; | |
Collapse file Copy file name to clipboardExpand all lines: benchmark/buffers/buffer-write.js +3-3Lines changed: 3 additions & 3 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -27,7 +27,7 @@ const types = [ | 27 | 27 | ]; | 28 | 28 |
| 29 | 29 | const bench = common.createBenchmark(main, { | 30 | | - buffer: ['fast'], | | 30 | + buffer: ['fast', 'slow'], | 31 | 31 | type: types, | 32 | 32 | n: [1e6], | 33 | 33 | }); | @@ -70,8 +70,8 @@ const byteLength = { | 70 | 70 | writeIntBE: 6, | 71 | 71 | }; | 72 | 72 |
| 73 | | -function main({ n, buf, type }) { | 74 | | - const buff = buf === 'fast' ? | | 73 | +function main({ n, buffer, type }) { | | 74 | + const buff = buffer === 'fast' ? | 75 | 75 | Buffer.alloc(8) : | 76 | 76 | Buffer.allocUnsafeSlow(8); | 77 | 77 | const fn = `write${type}`; | |
|