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