1'use strict'; 2 3const common = require('../common'); 4const Readable = require('stream').Readable; 5 6const bench = common.createBenchmark(main, { 7 n: [50e2], 8}); 9 10function main({ n }) { 11 const b = Buffer.alloc(32); 12 const s = new Readable(); 13 function noop() {} 14 s._read = noop; 15 16 bench.start(); 17 for (let k = 0; k < n; ++k) { 18 for (let i = 0; i < 1e4; ++i) 19 s.push(b); 20 while (s.read()); 21 } 22 bench.end(n); 23} 24