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

Function run

benchmark/streams/iter-throughput-transform.js:42–59  ·  view source on GitHub ↗
(cb)

Source from the content-addressed store, hash-verified

40
41function benchClassic(chunk, datasize, n, totalOps) {
42 function run(cb) {
43 let remaining = datasize;
44 const r = new Readable({
45 read() {
46 if (remaining <= 0) { this.push(null); return; }
47 const size = Math.min(remaining, chunk.length);
48 remaining -= size;
49 this.push(size === chunk.length ? chunk : chunk.subarray(0, size));
50 },
51 });
52 const t = new Transform({
53 transform(data, enc, cb) {
54 cb(null, copyBuf(data));
55 },
56 });
57 const w = new Writable({ write(data, enc, cb) { cb(); } });
58 pipeline(r, t, w, cb);
59 }
60
61 let i = 0;
62 bench.start();

Callers 3

benchClassicFunction · 0.70
benchWebStreamFunction · 0.70
benchIterFunction · 0.70

Calls 5

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

Tested by

no test coverage detected