0
0
mirror of https://github.com/nodejs/node.git synced 2024-11-25 16:34:05 +01:00
nodejs/benchmark/settimeout.js
2010-10-26 14:53:18 -07:00

16 lines
364 B
JavaScript

console.log("wait...");
var done = 0;
var N = 5000000;
var begin = new Date();
for (var i = 0; i < N; i++) {
setTimeout(function () {
if (++done == N) {
var end = new Date();
console.log("smaller is better");
console.log("startup: %d", start - begin);
console.log("done: %d", end - start);
}
}, 1000);
}
var start = new Date();