10 comments

[ 359 ms ] story [ 1579 ms ] thread
You should try to implement the Fib with tail call and then test it. http://en.wikipedia.org/wiki/Tail_call
First he should implement it properly, remembering last two values at any time. His way is just plain outrageous.
Here the comparison is not about the algorithm, but language with similar recursion logic.
Then he should have used appropriate function to calculate, Ackermann for instance.
Does anyone know why Java would be faster here? Is there any kind of optimization happening under the hood? (Automatic memoization?)
(comment deleted)
See the updated blog again. It seems issue is with Clang/LLVM on MacOSX. I reran the test on Linux with Gnu g++ and it outperforms Java.