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

Function main

benchmark/streams/readable-uint8array.js:11–36  ·  view source on GitHub ↗
({ n, kind })

Source from the content-addressed store, hash-verified

9const ABC = new Uint8Array([0x41, 0x42, 0x43]);
10
11function main({ n, kind }) {
12 switch (kind) {
13 case 'read': {
14 bench.start();
15 const readable = new Readable({
16 read() {},
17 });
18 for (let i = 0; i < n; ++i) readable.push(ABC);
19 bench.end(n);
20 break;
21 }
22
23 case 'encoding': {
24 bench.start();
25 const readable = new Readable({
26 read() {},
27 });
28 readable.setEncoding('utf8');
29 for (let i = 0; i < n; ++i) readable.push(ABC);
30 bench.end(n);
31 break;
32 }
33 default:
34 throw new Error('Invalid kind');
35 }
36}

Callers

nothing calls this directly

Calls 4

startMethod · 0.45
pushMethod · 0.45
endMethod · 0.45
setEncodingMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…