Closed kmisiunas closed 6 years ago
Memoization is cheating since none of the other languages do it, whereas they all could. Note that the point of this benchmark is to test how good a language is at recursion, not to compute Fibonacci numbers quickly. This turns it into a test of memoization rather than recursion.
The proposed version does not do memorisation across different calls. It is inside a Module[] which ensures that recursion calls happen anew for each fib[] call
On 26 Jun 2018, at 15:57, Stefan Karpinski notifications@github.com wrote:
Memoization is cheating since none of the other languages do it, whereas they all could.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/JuliaLang/Microbenchmarks/pull/15#issuecomment-400340639, or mute the thread https://github.com/notifications/unsubscribe-auth/AEmPa8dV6-CP1V-zdDgozIoH8uwlD_vWks5uAkv0gaJpZM4U4AOm.
Memoization within a single top-level fib computation is still cheating since it's not using the same doubly recursive algorithm as all the other implementations.
I see your point. Please reject the pull request since Mathematica's recursion is in-fact a lot slower.
I think the benchmark does not do justice to Mathematica but - at the same time - it is a better performance indicator if one writes complex algorithms from scratch. Anyhow, thanks for your excellent work on Julia!
It would be interesting to do a comparison of the memoized algorithm version across languages—dead simple, efficient memoization is one of Mathematica's really strong points.
Previous implementation of 'recursion_fibonacci' method was C code in Mathematica. Changed it to Mathematica-like implementation wrapped in Module[] to avoid cashing. On my Macbook pro the improvement is 42 times...
It is even faster if Module[] isolation is not used, but Mathematica does caching of previous results thus it would be not a fair comparison. Read more on: http://community.wolfram.com/groups/-/m/t/442573