24 ms·
I can't even begin to explain how wrong this benchmark and the author's conclusion is. I'd rather see a benchmark of apache vs a fibonacci function than read th
by cloudhead 15y ago
I can't even begin to explain how wrong this benchmark and the author's conclusion is. I'd rather see a benchmark of apache vs a fibonacci function than read this nonsense.
- nicklovescode 15y agoI just ran it, fib is roughly six times faster
- krakensden 15y agorecursive fib, memoized fib, or O(1) fib? Also, given that apache should run indefinitely, I would think the preferred result would be that fib is infinitely faster.
- nicklovescode 15y agoI couldn't determine which was the best, so I just calculated by hand instead
- aidenn0 15y agoThere is no O(1) fib.
- andreyf 15y agohttp://mathworld.wolfram.com/BinetsFibonacciNumberFormula.html http://mathworld.wolfram.com/BinetsFibonacciNumberFormula.ht...
- ddlatham 15y agohttp://www.haskell.org/haskellwiki/The_Fibonacci_sequence#Constant-time_implementations http://www.haskell.org/haskellwiki/The_Fibonacci_sequence#Co...
- aidenn0 15y agoCalculating that formula is not O(1), unless you have a way of calculating exponentiation, multiplication and subtraction all in O(1) time. A closed form does not O(1) make
- thesz 15y agoIt contains n-th power. So it is O(logN).
- davidtgoldblatt 15y agoIn fact, since the fibonacci sequence grows as O(phi^n), we need O(n) digits to hold the n'th fibonacci number, so the fastest possible algorithm to compute the n'th fibonacci number must run in time Omega(n).
- T-hawk 15y agoNot necessarily if you can parallelize computing the digits. Your average Pentium processor can compute a floating-point number with a mantissa of 16 decimal or 52 binary digits in one clock cycle, not 16 or 52. It does so by using enough silicon to compute them all in parallel.
- aidenn0 15y agoThat's only a constant factor improvement. What if you want to calculate 104 binary digits?
- deleted 15y ago[deleted]
- ldng 15y agoAndy Wingo knows quite well what he's doing. It's just a fun post. Read his 2/3 previous posts if you want more serious stuff on V8.