mirror of
https://github.com/nodejs/node.git
synced 2024-11-28 06:28:40 +01:00
18 lines
319 B
JavaScript
18 lines
319 B
JavaScript
|
'use strict';
|
||
|
const common = require('../common.js');
|
||
|
const bench = common.createBenchmark(main, {
|
||
|
n: [12e5]
|
||
|
});
|
||
|
|
||
|
function main({ n }) {
|
||
|
let counter = n;
|
||
|
bench.start();
|
||
|
queueMicrotask(onNextTick);
|
||
|
function onNextTick() {
|
||
|
if (--counter)
|
||
|
queueMicrotask(onNextTick);
|
||
|
else
|
||
|
bench.end(n);
|
||
|
}
|
||
|
}
|