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

Function benchIterSync

benchmark/streams/iter-throughput-pipeto.js:129–146  ·  view source on GitHub ↗
(chunk, datasize, n, totalOps)

Source from the content-addressed store, hash-verified

127}
128
129function benchIterSync(chunk, datasize, n, totalOps) {
130 const { pipeToSync } = require('stream/iter');
131
132 bench.start();
133 for (let i = 0; i < n; i++) {
134 let remaining = datasize;
135 function* source() {
136 while (remaining > 0) {
137 const size = Math.min(remaining, chunk.length);
138 remaining -= size;
139 yield [size === chunk.length ? chunk : chunk.subarray(0, size)];
140 }
141 }
142 const writer = { writeSync() {} };
143 pipeToSync(source(), writer);
144 }
145 bench.end(totalOps);
146}

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