Re:V8 is faster than GCC
by cloudhead on Friday June 10, 2011 @03:43PM
(#2642153)
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.
[ Parent
| on HN ]
Re:V8 is faster than GCC
by nicklovescode on Friday June 10, 2011 @04:07PM
(#2642223)
I just ran it, fib is roughly six times faster
Re:V8 is faster than GCC
by krakensden on Friday June 10, 2011 @04:31PM
(#2642295)
recursive 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.
There is no O(1) fib.
Calculating 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
It contains n-th power. So it is O(logN).
Re:V8 is faster than GCC
by davidtgoldblatt on Friday June 10, 2011 @07:08PM
(#2642740)
In 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).
Not 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.
That's only a constant factor improvement. What if you want to calculate 104 binary digits?
Re:V8 is faster than GCC
by nicklovescode on Friday June 10, 2011 @05:01PM
(#2642397)
I couldn't determine which was the best, so I just calculated by hand instead