• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1'use strict';
2const common = require('../common.js');
3const bench = common.createBenchmark(main, {
4  n: [4e6]
5});
6
7function main({ n }) {
8  function onNextTick(i) {
9    if (i + 1 === n)
10      bench.end(n);
11  }
12
13  for (let i = 0; i < n; i++) {
14    if (i % 4 === 0)
15      process.nextTick(onNextTick, i, true, 10, 'test');
16    else if (i % 3 === 0)
17      process.nextTick(onNextTick, i, true, 10);
18    else if (i % 2 === 0)
19      process.nextTick(onNextTick, i, 20);
20    else
21      process.nextTick(onNextTick, i);
22  }
23
24  bench.start();
25}
26