summaryrefslogtreecommitdiff
path: root/benchmark
diff options
context:
space:
mode:
authorRyan Dahl <ry@tinyclouds.org>2010-09-28 01:14:38 -0700
committerRyan Dahl <ry@tinyclouds.org>2010-09-28 01:14:38 -0700
commitf9d6b074cf75a250ccc705f51e7d71a85803085b (patch)
tree970e7aba8eefac8aa50defe61fd947fb82af7108 /benchmark
parent353e2565d5867f457c03e5e011b5e13a2254b96f (diff)
downloadandroid-node-v8-f9d6b074cf75a250ccc705f51e7d71a85803085b.tar.gz
android-node-v8-f9d6b074cf75a250ccc705f51e7d71a85803085b.tar.bz2
android-node-v8-f9d6b074cf75a250ccc705f51e7d71a85803085b.zip
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 f195842ca3..55e6ea116f 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));