Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nodejs/node.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRyan Dahl <ry@tinyclouds.org>2010-10-26 23:52:31 +0400
committerRyan Dahl <ry@tinyclouds.org>2010-10-27 01:53:18 +0400
commitbc47353bbe1836e4415cb08f1b6619839bff4d82 (patch)
tree6751b394baee67bb14127b680aef14bfd83658bf /benchmark
parent79944006e252170933e35862bdff2f7fba6bd762 (diff)
Use the timer list for setTimeout
Diffstat (limited to 'benchmark')
-rw-r--r--benchmark/settimeout.js15
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();