2016-02-20 02:03:16 +01:00
|
|
|
'use strict';
|
2017-09-14 03:48:53 +02:00
|
|
|
const common = require('../common.js');
|
|
|
|
const bench = common.createBenchmark(main, {
|
2019-01-12 04:36:26 +01:00
|
|
|
n: [7e6]
|
2013-02-12 07:50:30 +01:00
|
|
|
});
|
2011-12-23 03:09:36 +01:00
|
|
|
|
2018-03-17 16:19:09 +01:00
|
|
|
function main({ n }) {
|
2018-05-02 10:12:54 +02:00
|
|
|
let counter = n;
|
2013-02-12 07:50:30 +01:00
|
|
|
bench.start();
|
|
|
|
process.nextTick(onNextTick);
|
|
|
|
function onNextTick() {
|
2018-05-02 10:12:54 +02:00
|
|
|
if (--counter)
|
2013-02-12 07:50:30 +01:00
|
|
|
process.nextTick(onNextTick);
|
|
|
|
else
|
2018-03-17 16:19:09 +01:00
|
|
|
bench.end(n);
|
2013-02-12 07:50:30 +01:00
|
|
|
}
|
|
|
|
}
|