Skip to content

Commit

Permalink
output time of function calls
Browse files Browse the repository at this point in the history
  • Loading branch information
ry committed Sep 28, 2010
1 parent 353e256 commit f9d6b07
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions benchmark/function_call/bench.js
Original file line number Diff line number Diff line change
Expand Up @@ -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));


0 comments on commit f9d6b07

Please sign in to comment.