node/benchmark/process/queue-microtask-depth.js
Antoine du Hamel 9d9b3f856f
benchmark: add trailing commas in benchmark/process
PR-URL: https://github.com/nodejs/node/pull/46481
Reviewed-By: Darshan Sen <raisinten@gmail.com>
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
2023-02-18 16:03:05 -05:00

17 lines
320 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);
}
}