[m-users.] Too Slow

Matthias Guedemann matthias.guedemann at googlemail.com
Wed Apr 15 19:19:18 AEST 2015


Hi Robert,

> Thank you, Matthias. The fix you propose is beyond my programming
> skills and my interest level. But you've given me insight into where
> the problem lies. I think the memory blowup problem may be the result
> of the "rho/1" procedure being coded in such a way that it isn't tail
> recursive. That problem, I can tackle.

I am not an expert on this, so I do not know exactly whether this will
work for your predicate, but the option

,----
| --introduce-accumulators
|         Attempt to introduce accumulating variables into
|         procedures, so as to make them tail recursive.
`----

can often do this automatically.

>From a first profiling, it seems that a lot of time is spent in
`integer.mod/3` and `integer.pow/3`. Once you make the changes proposed
by Zoltan and Julien, do not hesitate to contact me and send me the
program (also off-list if you like). I am interested in optimizing these
routines.

Best regards,
Matthias



More information about the users mailing list