diff options
author | Ryan Dahl <ry@tinyclouds.org> | 2010-10-26 23:52:31 +0400 |
---|---|---|
committer | Ryan Dahl <ry@tinyclouds.org> | 2010-10-27 01:53:18 +0400 |
commit | bc47353bbe1836e4415cb08f1b6619839bff4d82 (patch) | |
tree | 6751b394baee67bb14127b680aef14bfd83658bf /benchmark | |
parent | 79944006e252170933e35862bdff2f7fba6bd762 (diff) |
Use the timer list for setTimeout
Diffstat (limited to 'benchmark')
-rw-r--r-- | benchmark/settimeout.js | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/benchmark/settimeout.js b/benchmark/settimeout.js new file mode 100644 index 00000000000..dd52dc90e95 --- /dev/null +++ b/benchmark/settimeout.js @@ -0,0 +1,15 @@ +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(); |