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

Function main

benchmark/zlib/crc32.js:31–47  ·  view source on GitHub ↗
({ type, len, n })

Source from the content-addressed store, hash-verified

29}
30
31function main({ type, len, n }) {
32 // Scale iterations so that total processed bytes roughly constant around n*4096 bytes.
33 const scale = 4096 / len;
34 const iters = Math.max(1, Math.floor(n * scale));
35
36 const data = type === 'buffer' ? makeBuffer(len) : makeAsciiString(len);
37
38 let acc = 0;
39 for (let i = 0; i < Math.min(iters, 10000); i++) acc ^= crc32(data, 0);
40
41 bench.start();
42 let sum = 0;
43 for (let i = 0; i < iters; i++) sum ^= crc32(data, 0);
44 bench.end(iters);
45
46 if (sum === acc - 1) process.stderr.write('');
47}

Callers

nothing calls this directly

Calls 8

makeAsciiStringFunction · 0.85
crc32Function · 0.85
makeBufferFunction · 0.70
maxMethod · 0.45
minMethod · 0.45
startMethod · 0.45
endMethod · 0.45
writeMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…