1'use strict'; 2const common = require('../common.js'); 3 4const bench = common.createBenchmark(main, { 5 n: [5e6], 6}); 7 8function main({ n }) { 9 let j = 0; 10 bench.start(); 11 function cb() { 12 j++; 13 if (j === n) 14 bench.end(n); 15 } 16 for (let i = 0; i < n; i++) { 17 setTimeout(cb, 1); 18 } 19} 20