2016-05-31 17:03:59 +00:00
|
|
|
'use strict';
|
|
|
|
|
|
|
|
const common = require('../common');
|
|
|
|
const Readable = require('stream').Readable;
|
|
|
|
|
|
|
|
const bench = common.createBenchmark(main, {
|
2023-01-29 18:13:35 +00:00
|
|
|
n: [1e3],
|
2016-05-31 17:03:59 +00:00
|
|
|
});
|
|
|
|
|
2017-12-30 02:56:10 +00:00
|
|
|
function main({ n }) {
|
2018-02-24 16:52:14 +00:00
|
|
|
const b = Buffer.alloc(32);
|
2016-05-31 17:03:59 +00:00
|
|
|
const s = new Readable();
|
|
|
|
function noop() {}
|
|
|
|
s._read = noop;
|
|
|
|
|
|
|
|
bench.start();
|
2020-01-31 15:50:00 +00:00
|
|
|
for (let k = 0; k < n; ++k) {
|
|
|
|
for (let i = 0; i < 1e4; ++i)
|
2016-05-31 17:03:59 +00:00
|
|
|
s.push(b);
|
|
|
|
while (s.read(106));
|
|
|
|
}
|
|
|
|
bench.end(n);
|
|
|
|
}
|