11cb0ef41Sopenharmony_ci'use strict'; 21cb0ef41Sopenharmony_ci 31cb0ef41Sopenharmony_ciconst common = require('../common'); 41cb0ef41Sopenharmony_ciconst Readable = require('stream').Readable; 51cb0ef41Sopenharmony_ci 61cb0ef41Sopenharmony_ciconst bench = common.createBenchmark(main, { 71cb0ef41Sopenharmony_ci n: [50e2], 81cb0ef41Sopenharmony_ci}); 91cb0ef41Sopenharmony_ci 101cb0ef41Sopenharmony_cifunction main({ n }) { 111cb0ef41Sopenharmony_ci const b = Buffer.alloc(32); 121cb0ef41Sopenharmony_ci const s = new Readable(); 131cb0ef41Sopenharmony_ci function noop() {} 141cb0ef41Sopenharmony_ci s._read = noop; 151cb0ef41Sopenharmony_ci 161cb0ef41Sopenharmony_ci bench.start(); 171cb0ef41Sopenharmony_ci for (let k = 0; k < n; ++k) { 181cb0ef41Sopenharmony_ci for (let i = 0; i < 1e4; ++i) 191cb0ef41Sopenharmony_ci s.push(b); 201cb0ef41Sopenharmony_ci while (s.read()); 211cb0ef41Sopenharmony_ci } 221cb0ef41Sopenharmony_ci bench.end(n); 231cb0ef41Sopenharmony_ci} 24