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

Function benchIter

benchmark/streams/iter-throughput-compression.js:82–104  ·  view source on GitHub ↗
(chunk, datasize, n, totalOps)

Source from the content-addressed store, hash-verified

80}
81
82function benchIter(chunk, datasize, n, totalOps) {
83 const { pipeTo } = require('stream/iter');
84 const { compressGzip, decompressGzip } = require('zlib/iter');
85
86 async function run() {
87 let remaining = datasize;
88 async function* source() {
89 while (remaining > 0) {
90 const size = Math.min(remaining, chunk.length);
91 remaining -= size;
92 yield [size === chunk.length ? chunk : chunk.subarray(0, size)];
93 }
94 }
95 await pipeTo(source(), compressGzip(), decompressGzip(),
96 { write() {}, writeSync() { return true; } });
97 }
98
99 (async () => {
100 bench.start();
101 for (let i = 0; i < n; i++) await run();
102 bench.end(totalOps);
103 })();
104}

Callers 1

mainFunction · 0.70

Calls 4

runFunction · 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…