[m-users.] Too Slow

Julien Fischer jfischer at opturion.com
Wed Apr 15 09:38:27 AEST 2015


On Wed, 15 Apr 2015, Zoltan Somogyi wrote:

> On Tue, 14 Apr 2015 09:38:12 -0700, Delmas Buckley <rbuckley at ieee.org> wrote:
>> Does anyone have any suggestions for speedup, other than "Avoid using
>> Mercury for this purpose"?
>
> You may want to consider eliminating the massive amounts of redundant
> computation that your code is doing, to wit, constructing the arbitrary-precision
> representations of your constants over and over and over and over and over ...
> Since each call to integer/1 allocates memory, I am not surprised that you
> ended up thrashing your machine.

Along those lines, the integer module already provides the constant
functions integer.zero/0 and integer.one/1 which are equivalent to
integer(0) and integer(1) respectively, but won't allocate memory.

Cheers,
Julien.



More information about the users mailing list