({ consumers, batches, backpressure, n })
| 12 | }); |
| 13 | |
| 14 | async function main({ consumers, batches, backpressure, n }) { |
| 15 | const { share, array } = require('stream/iter'); |
| 16 | const chunk = Buffer.alloc(1024); |
| 17 | const totalOps = batches * consumers * n; |
| 18 | |
| 19 | async function* source() { |
| 20 | for (let i = 0; i < batches; i++) { |
| 21 | yield [chunk]; |
| 22 | } |
| 23 | } |
| 24 | |
| 25 | bench.start(); |
| 26 | for (let i = 0; i < n; i++) { |
| 27 | const shared = share(source(), { highWaterMark: 64, backpressure }); |
| 28 | const readers = Array.from({ length: consumers }, () => array(shared.pull())); |
| 29 | await Promise.all(readers); |
| 30 | } |
| 31 | bench.end(totalOps); |
| 32 | } |
nothing calls this directly
no test coverage detected
searching dependent graphs…