mirror of
https://github.com/nodejs/node.git
synced 2024-12-01 16:10:02 +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>
22 lines
301 B
JavaScript
22 lines
301 B
JavaScript
'use strict';
|
|
|
|
const common = require('../common.js');
|
|
const bench = common.createBenchmark(main, {
|
|
n: [4e5]
|
|
});
|
|
|
|
function main({ n }) {
|
|
var j = 0;
|
|
|
|
function cb() {
|
|
j++;
|
|
if (j === n)
|
|
bench.end(n);
|
|
}
|
|
|
|
bench.start();
|
|
for (var i = 0; i < n; i++) {
|
|
queueMicrotask(cb);
|
|
}
|
|
}
|