mirror of
https://github.com/nodejs/node.git
synced 2025-05-02 14:56:19 +00:00

The next-tick-exec benchmarks were meant to track nextTick execution time but due to an error, they actually track addition and execution. PR-URL: https://github.com/nodejs/node/pull/20462 Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
19 lines
304 B
JavaScript
19 lines
304 B
JavaScript
'use strict';
|
|
const common = require('../common.js');
|
|
const bench = common.createBenchmark(main, {
|
|
n: [5e6]
|
|
});
|
|
|
|
function main({ n }) {
|
|
function onNextTick(i) {
|
|
if (i + 1 === n)
|
|
bench.end(n);
|
|
}
|
|
|
|
for (var i = 0; i < n; i++) {
|
|
process.nextTick(onNextTick, i);
|
|
}
|
|
|
|
bench.start();
|
|
}
|