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-09-28 12:14:38 +0400
committerRyan Dahl <ry@tinyclouds.org>2010-09-28 12:14:38 +0400
commitf9d6b074cf75a250ccc705f51e7d71a85803085b (patch)
tree970e7aba8eefac8aa50defe61fd947fb82af7108 /benchmark
parent353e2565d5867f457c03e5e011b5e13a2254b96f (diff)
output time of function calls
Diffstat (limited to 'benchmark')
-rw-r--r--benchmark/function_call/bench.js8
1 files changed, 8 insertions, 0 deletions
diff --git a/benchmark/function_call/bench.js b/benchmark/function_call/bench.js
index f195842ca33..55e6ea116fd 100644
--- a/benchmark/function_call/bench.js
+++ b/benchmark/function_call/bench.js
@@ -30,6 +30,14 @@ for (i = 0; i < N; i++) {
var cxxDiff = new Date() - start;
console.log(N +" C++ function calls: " + cxxDiff);
+function toMicro (diff) {
+ return (diff / N) * 1000000;
+}
+
+console.log("\nJS function call speed: %d microseconds", toMicro(jsDiff));
+console.log("C++ function call speed: %d microseconds", toMicro(cxxDiff));
+
+
console.log("\nJS speedup " + (cxxDiff / jsDiff));