enclose-io/compiler

View on GitHub
current/benchmark/process/next-tick-depth.js

Summary

Maintainability
A
2 hrs
Test Coverage
'use strict';
const common = require('../common.js');
const bench = common.createBenchmark(main, {
  n: [7e6]
});

function main({ n }) {
  let counter = n;
  bench.start();
  process.nextTick(onNextTick);
  function onNextTick() {
    if (--counter)
      process.nextTick(onNextTick);
    else
      bench.end(n);
  }
}