diff options
author | Ryan Dahl <ry@tinyclouds.org> | 2010-09-28 12:14:38 +0400 |
---|---|---|
committer | Ryan Dahl <ry@tinyclouds.org> | 2010-09-28 12:14:38 +0400 |
commit | f9d6b074cf75a250ccc705f51e7d71a85803085b (patch) | |
tree | 970e7aba8eefac8aa50defe61fd947fb82af7108 /benchmark | |
parent | 353e2565d5867f457c03e5e011b5e13a2254b96f (diff) |
output time of function calls
Diffstat (limited to 'benchmark')
-rw-r--r-- | benchmark/function_call/bench.js | 8 |
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)); |