2016-11-07 01:47:41 +01:00
|
|
|
'use strict';
|
2017-09-14 03:48:53 +02:00
|
|
|
const common = require('../common.js');
|
2016-11-07 01:47:41 +01:00
|
|
|
|
2017-09-14 03:48:53 +02:00
|
|
|
const bench = common.createBenchmark(main, {
|
2018-03-17 16:19:09 +01:00
|
|
|
n: [5e6],
|
2016-11-07 01:47:41 +01:00
|
|
|
});
|
|
|
|
|
2018-03-17 16:19:09 +01:00
|
|
|
function main({ n }) {
|
|
|
|
var j = 0;
|
2016-11-07 01:47:41 +01:00
|
|
|
bench.start();
|
|
|
|
function cb() {
|
2018-03-17 16:19:09 +01:00
|
|
|
j++;
|
|
|
|
if (j === n)
|
|
|
|
bench.end(n);
|
2016-11-07 01:47:41 +01:00
|
|
|
}
|
2019-07-31 15:26:38 +02:00
|
|
|
for (let i = 0; i < n; i++) {
|
2016-11-07 01:47:41 +01:00
|
|
|
setTimeout(cb, 1);
|
|
|
|
}
|
|
|
|
}
|