mirror of
https://github.com/nodejs/node.git
synced 2024-11-29 23:16:30 +01:00
2c49e8b537
No longer create an additional scope within queueMicrotask in order to improve performance. PR-URL: https://github.com/nodejs/node/pull/27032 Reviewed-By: Gus Caplan <me@gus.host> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: James M Snell <jasnell@gmail.com>
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);
|
|
}
|
|
}
|