MCPcopy Index your code
hub / github.com/nodejs/node / benchIterSync

Function benchIterSync

benchmark/streams/iter-throughput-identity.js:115–132  ·  view source on GitHub ↗
(chunk, datasize, n, totalOps)

Source from the content-addressed store, hash-verified

113}
114
115function benchIterSync(chunk, datasize, n, totalOps) {
116 const { pipeToSync } = require('stream/iter');
117
118 bench.start();
119 for (let i = 0; i < n; i++) {
120 let remaining = datasize;
121 function* source() {
122 while (remaining > 0) {
123 const size = Math.min(remaining, chunk.length);
124 remaining -= size;
125 yield [size === chunk.length ? chunk : chunk.subarray(0, size)];
126 }
127 }
128 // Drain to no-op sink, matching other benchmarks
129 pipeToSync(source(), { writeSync() {} });
130 }
131 bench.end(totalOps);
132}

Callers 1

mainFunction · 0.70

Calls 5

pipeToSyncFunction · 0.85
sourceFunction · 0.70
requireFunction · 0.50
startMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…