MCPcopy Create free account
hub / github.com/nodejs/node / main

Function main

benchmark/streams/iter-throughput-broadcast.js:20–32  ·  view source on GitHub ↗
({ api, consumers, datasize, n })

Source from the content-addressed store, hash-verified

18const CHUNK_SIZE = 64 * 1024;
19
20function main({ api, consumers, datasize, n }) {
21 const chunk = Buffer.alloc(CHUNK_SIZE, 'abcdefghij');
22 const totalOps = (datasize * n) / (1024 * 1024);
23
24 switch (api) {
25 case 'classic':
26 return benchClassic(chunk, consumers, datasize, n, totalOps);
27 case 'webstream':
28 return benchWebStream(chunk, consumers, datasize, n, totalOps);
29 case 'iter':
30 return benchIter(chunk, consumers, datasize, n, totalOps);
31 }
32}
33
34function benchClassic(chunk, numConsumers, datasize, n, totalOps) {
35 function run(cb) {

Callers

nothing calls this directly

Calls 4

allocMethod · 0.80
benchClassicFunction · 0.70
benchWebStreamFunction · 0.70
benchIterFunction · 0.70

Tested by

no test coverage detected