mirror of
https://github.com/nodejs/node.git
synced 2024-11-24 20:29:23 +01:00
de877c5781
PR-URL: https://github.com/nodejs/node/pull/31794 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
20 lines
299 B
JavaScript
20 lines
299 B
JavaScript
'use strict';
|
|
const common = require('../common.js');
|
|
|
|
const bench = common.createBenchmark(main, {
|
|
n: [5e6],
|
|
});
|
|
|
|
function main({ n }) {
|
|
let j = 0;
|
|
bench.start();
|
|
function cb() {
|
|
j++;
|
|
if (j === n)
|
|
bench.end(n);
|
|
}
|
|
for (let i = 0; i < n; i++) {
|
|
setTimeout(cb, 1);
|
|
}
|
|
}
|