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

Function run

benchmark/streams/iter-throughput-compression.js:34–46  ·  view source on GitHub ↗
(cb)

Source from the content-addressed store, hash-verified

32
33function benchClassic(chunk, datasize, n, totalOps) {
34 function run(cb) {
35 let remaining = datasize;
36 const r = new Readable({
37 read() {
38 if (remaining <= 0) { this.push(null); return; }
39 const size = Math.min(remaining, chunk.length);
40 remaining -= size;
41 this.push(size === chunk.length ? chunk : chunk.subarray(0, size));
42 },
43 });
44 const w = new Writable({ write(data, enc, cb) { cb(); } });
45 pipeline(r, zlib.createGzip(), zlib.createGunzip(), w, cb);
46 }
47
48 let i = 0;
49 bench.start();

Callers 3

benchClassicFunction · 0.70
benchWebStreamFunction · 0.70
benchIterFunction · 0.70

Calls 7

pipeThroughMethod · 0.95
pipeToFunction · 0.85
compressGzipFunction · 0.85
decompressGzipFunction · 0.85
sourceFunction · 0.70
pipelineFunction · 0.50
pipeToMethod · 0.45

Tested by

no test coverage detected