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

Function benchIterSync

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

Source from the content-addressed store, hash-verified

123}
124
125function benchIterSync(chunk, datasize, n, totalOps) {
126 const { pipeToSync } = require('stream/iter');
127
128 const upper = (chunks) => {
129 if (chunks === null) return null;
130 return chunks.map((c) => copyBuf(c));
131 };
132
133 bench.start();
134 for (let i = 0; i < n; i++) {
135 let remaining = datasize;
136 function* source() {
137 while (remaining > 0) {
138 const size = Math.min(remaining, chunk.length);
139 remaining -= size;
140 yield [size === chunk.length ? chunk : chunk.subarray(0, size)];
141 }
142 }
143 pipeToSync(source(), upper, { writeSync() {} });
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

Used in the wild real call sites across dependent graphs

searching dependent graphs…