|
|
|
|
|
by aeon10
4887 days ago
|
|
Yes, I understand that recursion is much more appealing and leads to much cleaner and elegant code than iterative solutions. and thank you for the introduction to the community I suppose. Anyway I forked the original code, added an iterative version based on the comment by (Nick Craig Wood)
(https://github.com/AeonAxan/benchmarking_fibonacci) Here are the benchmarks
[recursive fib: 7,765 ms] |
[iterative fib: 8,047 ms] |
[analytic opt fib: 54,875] |
[analytic fib: 103,937 ms] | And it appears that the recursive version is faster than the naive iterative version by a few hundred milliseconds. |
|
[Recursive - 7921 ms], [Iteratiive - 8078 ms]
So the difference is negligible.