On Sun, Apr 13, 2008 at 12:43 PM, Bill Wood <william.wood3 at comcast.net> wrote:
> There must be a lot of overhead in the maxima-to-lisp translations of
> functions. I compiled foo and then ran "foo(5000000)" -- it took 2
> minutes wall time. My lisp version (CMUCL) using my own implementation
> of power_mod took 15 sec. after compilation.
Partly there is indeed some extra overhead.. But partly it's simply
because the translator tries to respect Maxima semantics, which means
that the general case of symbolic values must be handled, f(x) where f
is undefined returns f(x) not an error, etc. In your example, the
translator has no way of knowing that "bound" is an integer value, for
example. And power_mod is not declared internally as an
integer-valued function (this is a bug).
Try declaring your variables and functions as integer-valued and see
how much that helps:
foo(bound) := block([m],
modedeclare([m,bound,function(power_mod)],integer), ...
Let us know,
-s