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

Function benchIter

benchmark/streams/iter-creation.js:79–99  ·  view source on GitHub ↗
(type, n)

Source from the content-addressed store, hash-verified

77}
78
79function benchIter(type, n) {
80 const { push, from, duplex } = require('stream/iter');
81 let tmp;
82
83 bench.start();
84 switch (type) {
85 case 'readable':
86 for (let i = 0; i < n; i++) tmp = from('x');
87 break;
88 case 'writable':
89 // push() creates a writer+readable pair
90 for (let i = 0; i < n; i++) tmp = push();
91 break;
92 case 'pair':
93 // duplex() creates a bidirectional channel pair
94 for (let i = 0; i < n; i++) tmp = duplex();
95 break;
96 }
97 bench.end(n);
98 ok(tmp !== undefined);
99}

Callers 1

mainFunction · 0.70

Calls 7

duplexFunction · 0.85
okFunction · 0.85
requireFunction · 0.50
fromFunction · 0.50
pushFunction · 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…