compilation speeds



-----Raymond Toy wrote: -----

>Are you manipulating numbers or doing symbolic
>math?  If the latter, I would expect compiling
>not to help much at all.

Compiling a Maxima function does remove tail-recursion. (Maybe CL
isn't required to do this, but GCL does.) Removing tail-recursion
allows a recursively defined function to handle larger data:

(%i1) sumlist(l) := if l = [] then 0 else first(l) + sumlist(rest(l))$
(%i2) p : makelist((-1)^k,k,1,1000)$
(%i3) sumlist(p);
Error in PROGN [or a callee]: Bind stack overflow.

Let's compile and re-try:

(%i4) compile(sumlist)$
(%i5) sumlist(p);
(%o5) 0

So even when the Maxima translator isn't able to speed things up, sometimes
there is an advantage to compiling Maxima code.

Barton