GeezerVison is showing github.com — benchmark: fix buffer option in buffer read/write benchmarks · nodejs/node@d429651
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 |
|---|
@@ -9,14 +9,14 @@ const types = [ | 9 | 9 | ]; | 10 | 10 |
| 11 | 11 | const bench = common.createBenchmark(main, { | 12 | | - buffer: ['fast'], | | 12 | + buffer: ['fast', 'slow'], | 13 | 13 | type: types, | 14 | 14 | n: [1e6], | 15 | | - byteLength: [1, 2, 3, 4, 5, 6], | | 15 | + byteLength: [1, 2, 4, 6], | 16 | 16 | }); | 17 | 17 |
| 18 | | -function main({ n, buf, type, byteLength }) { | 19 | | - const buff = buf === 'fast' ? | | 18 | +function main({ n, buffer, type, byteLength }) { | | 19 | + const buff = buffer === 'fast' ? | 20 | 20 | Buffer.alloc(8) : | 21 | 21 | require('buffer').SlowBuffer(8); | 22 | 22 | 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 |
|---|
@@ -19,13 +19,13 @@ const types = [ | 19 | 19 | ]; | 20 | 20 |
| 21 | 21 | const bench = common.createBenchmark(main, { | 22 | | - buffer: ['fast'], | | 22 | + buffer: ['fast', 'slow'], | 23 | 23 | type: types, | 24 | 24 | n: [1e6], | 25 | 25 | }); | 26 | 26 |
| 27 | | -function main({ n, buf, type }) { | 28 | | - const buff = buf === 'fast' ? | | 27 | +function main({ n, buffer, type }) { | | 28 | + const buff = buffer === 'fast' ? | 29 | 29 | Buffer.alloc(8) : | 30 | 30 | require('buffer').SlowBuffer(8); | 31 | 31 | 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 | require('buffer').SlowBuffer(8); | 77 | 77 | const fn = `write${type}`; | |
|