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

Function benchClassic

benchmark/streams/iter-file-read.js:45–64  ·  view source on GitHub ↗
(filesize, n, totalOps)

Source from the content-addressed store, hash-verified

43}
44
45function benchClassic(filesize, n, totalOps) {
46 function run(cb) {
47 const r = fs.createReadStream(filename);
48 const w = new Writable({ write(data, enc, cb) { cb(); } });
49 pipeline(r, w, cb);
50 }
51
52 // Warmup
53 run(() => {
54 let i = 0;
55 bench.start();
56 (function next() {
57 if (i++ >= n) {
58 fs.unlinkSync(filename);
59 return bench.end(totalOps);
60 }
61 run(next);
62 })();
63 });
64}
65
66function benchWebStream(filesize, n, totalOps) {
67 const fsp = require('fs/promises');

Callers 1

mainFunction · 0.70

Calls 4

runFunction · 0.70
startMethod · 0.45
unlinkSyncMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected