diff options
author | Ryan Dahl <ry@tinyclouds.org> | 2010-10-26 12:52:31 -0700 |
---|---|---|
committer | Ryan Dahl <ry@tinyclouds.org> | 2010-10-26 14:53:18 -0700 |
commit | bc47353bbe1836e4415cb08f1b6619839bff4d82 (patch) | |
tree | 6751b394baee67bb14127b680aef14bfd83658bf /benchmark | |
parent | 79944006e252170933e35862bdff2f7fba6bd762 (diff) | |
download | node-new-bc47353bbe1836e4415cb08f1b6619839bff4d82.tar.gz |
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 0000000000..dd52dc90e9 --- /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(); |