Fibonacci(50) Performance: Java C C++ D Go Terra (Lua) Lua-JIT (Lua) (joshitech.blogspot.com) 4 points by rjoshi 11y ago ↗ HN
[–] senthadev 11y ago ↗ You should try to implement the Fib with tail call and then test it. http://en.wikipedia.org/wiki/Tail_call [–] dozzie 11y ago ↗ First he should implement it properly, remembering last two values at any time. His way is just plain outrageous. [–] rjoshi 11y ago ↗ Here the comparison is not about the algorithm, but language with similar recursion logic. [–] dozzie 11y ago ↗ Then he should have used appropriate function to calculate, Ackermann for instance.
[–] dozzie 11y ago ↗ First he should implement it properly, remembering last two values at any time. His way is just plain outrageous. [–] rjoshi 11y ago ↗ Here the comparison is not about the algorithm, but language with similar recursion logic. [–] dozzie 11y ago ↗ Then he should have used appropriate function to calculate, Ackermann for instance.
[–] rjoshi 11y ago ↗ Here the comparison is not about the algorithm, but language with similar recursion logic. [–] dozzie 11y ago ↗ Then he should have used appropriate function to calculate, Ackermann for instance.
[–] dozzie 11y ago ↗ Then he should have used appropriate function to calculate, Ackermann for instance.
[–] bjorg 11y ago ↗ I wonder if the author validated the results returned by Java for Fibonacci 50. Performance can increase significantly when correctness is not an issue. :) [–] rjoshi 11y ago ↗ Yes, if you look at the https://github.com/rohitjoshi/lang-compare/blob/master/fibon..., it print fibonacci (50) = 12586269025
[–] rjoshi 11y ago ↗ Yes, if you look at the https://github.com/rohitjoshi/lang-compare/blob/master/fibon..., it print fibonacci (50) = 12586269025
[–] tasoeur 11y ago ↗ Does anyone know why Java would be faster here? Is there any kind of optimization happening under the hood? (Automatic memoization?) [–] [deleted] 11y ago ↗ (comment deleted) [–] rjoshi 11y ago ↗ 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.
[–] rjoshi 11y ago ↗ 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.
[–] igouy 11y ago ↗ Back in the day, when we didn't know any better...https://web.archive.org/web/20080729072224/http://shootout.a...
10 comments
[ 359 ms ] story [ 1579 ms ] threadhttps://web.archive.org/web/20080729072224/http://shootout.a...