News for hackers. Stuff that matters.
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.

Re:V8 is faster than GCC by aidenn0 on Friday June 10, 2011 @05:43PM (#2642525)
There is no O(1) fib.
Re:V8 is faster than GCC by andreyf on Friday June 10, 2011 @05:46PM (#2642536)
Re:V8 is faster than GCC by aidenn0 on Friday June 10, 2011 @05:59PM (#2642576)
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

Re:V8 is faster than GCC by thesz on Friday June 10, 2011 @06:00PM (#2642578)
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).
Re:V8 is faster than GCC by T-hawk on Saturday June 11, 2011 @12:31AM (#2643211)
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.
Re:V8 is faster than GCC by aidenn0 on Thursday June 16, 2011 @01:12PM (#2662191)
That's only a constant factor improvement. What if you want to calculate 104 binary digits?
Re:V8 is faster than GCC by ddlatham on Friday June 10, 2011 @05:58PM (#2642573)
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