• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1'use strict';
2
3const common = require('../common');
4const Readable = require('stream').Readable;
5
6const bench = common.createBenchmark(main, {
7  n: [1e7],
8});
9
10async function main({ n }) {
11  const arr = [];
12  for (let i = 0; i < n; i++) {
13    arr.push(`${i}`);
14  }
15
16  const s = new Readable.from(arr);
17
18  bench.start();
19  s.on('data', (data) => {
20    // eslint-disable-next-line no-unused-expressions
21    data;
22  });
23  s.on('close', () => {
24    bench.end(n);
25  });
26}
27