Subject: "fastfib" in the gf package faster than "fib"
From: Stavros Macrakis
Date: Sun, 6 Jul 2008 16:11:49 -0400
On Sun, Jul 6, 2008 at 2:08 PM, Fabrizio Caruso <caruso at dm.unipi.it> wrote:
> I could try to convince you by telling you that the Fibonacci sequence is an important sequence with lots of applications
Surely speed isn't the issue: the current standard code in combin.lisp
seems to be only 30% slower than fastfib for argument values from 1 to
10^8. Is your problem that built-in fib doesn't return a numerical
value for arg >= 2^31? That is easily fixable.
> and it is often used by casual users to test how fast a system is.
That's a silly reason to change our code. Should we also optimize the
calculation of %pi, fpprec=100000, bfloat and 10000! for these
unsophisticated users?
Frankly, I don't know the applications of large Fibonacci numbers, but
given that Maxima's strength is *symbolic* calculation, I would be
much happier to see work on simplifications like fib(n+1)-fib(n) =>
fib(n-1) and the like than on small speedups for large arguments. Of
course that is harder....
By the way, the current behavior of fib, where it modifies the global
variable prevfib, strikes me as really ugly design. What is the
purpose of this?
-s