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

Function benchIter

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

Source from the content-addressed store, hash-verified

86}
87
88function benchIter(filesize, n, totalOps) {
89 const fsp = require('fs/promises');
90 const { pipeTo } = require('stream/iter');
91
92 async function run() {
93 const fh = await fsp.open(filename, 'r');
94 await pipeTo(fh.pull(), { write() {} });
95 await fh.close();
96 }
97
98 (async () => {
99 // Warmup
100 await run();
101
102 bench.start();
103 for (let i = 0; i < n; i++) await run();
104 fs.unlinkSync(filename);
105 bench.end(totalOps);
106 })();
107}

Callers 1

mainFunction · 0.70

Calls 5

runFunction · 0.70
requireFunction · 0.50
startMethod · 0.45
unlinkSyncMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…