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

Function benchPull

benchmark/fs/bench-filehandle-pull-vs-webstream.js:155–174  ·  view source on GitHub ↗
(n, filesize, compression)

Source from the content-addressed store, hash-verified

153// Pull/iter path: pull() with uppercase transform + selected compression
154// ---------------------------------------------------------------------------
155async function benchPull(n, filesize, compression) {
156 const iter = require('zlib/iter');
157
158 const compressFactory = {
159 gzip: iter.compressGzip,
160 deflate: iter.compressDeflate,
161 brotli: iter.compressBrotli,
162 zstd: iter.compressZstd,
163 }[compression];
164
165 // Warm up
166 await runPull(compressFactory);
167
168 bench.start();
169 let totalBytes = 0;
170 for (let i = 0; i < n; i++) {
171 totalBytes += await runPull(compressFactory);
172 }
173 bench.end(totalBytes / (1024 * 1024));
174}
175
176async function runPull(compressFactory) {
177 const fh = await fs.promises.open(filename, 'r');

Callers 1

mainFunction · 0.85

Calls 4

runPullFunction · 0.85
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…