[m-users.] Too Slow
Delmas Buckley
rbuckley at ieee.org
Sun May 17 01:54:54 AEST 2015
On April 14 I wrote complaining that Mercury 14.01.1 is too slow when
factoring large composite numbers into their prime factors. Several
suggestions for improvement were made by users and these were incorporated
into my Mercury programs resulting in some slight improvement. And then
Matthias Guedemann got involved and, over a period of about 25 days, he
created a faster bignum library that he calls mp_int. Using mp_int in place
of the standard Mercury integer library has increased the speed of
factoring by better than an order of magnitude. For comparison purposes I
have attached the new modules corresponding to those attached to my
original post. Also attached is the mp_int module and a module, mp, in
which numerous integers, large and small are defined and memoized.
Best regards,
Robert Buckley
On Tue, Apr 14, 2015 at 9:38 AM, Delmas Buckley <rbuckley at ieee.org> wrote:
> Hello -- I learned enough Mercury to translate a Miller-Rabin primality
> test and construct a process using that test to implement a prime
> factorization of large composite numbers (large being < 65 decimal digits).
> I run this in Mercury 14.01.1 under Ubuntu 64-bit running on an Apple Mac
> Pro using the Yosemite OS and VMWare's Fusion. When I installed Mercury
> into Ubuntu I used the --disable-most-grades option. *I am very
> disappointed with the slowness* of the procedures written for Mercury,
> and sometimes memory usage begins to blow up (slowly, over time as the
> process runs. Some of these run overnight). When I say I'm disappointed in
> the Mercury performance, I mean that by comparison with similar procedures
> I run written in Prolog, Erlang, Haskell, and Scheme, Mercury is much too
> slow, often taking 10 times or more as much time to complete. The Mercury
> runs I've made (not including those abandoned because of memory blowup) do
> complete and get correct results, but take way too much time to run.
>
> Does anyone have any suggestions for speedup, other than "Avoid using
> Mercury for this purpose"? I'm attaching copies of the source code of the
> procedures that run so slowly.
>
> Best regards,
> Robert Buckley
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mercurylang.org/archives/users/attachments/20150516/cf36f356/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test_primeFactors_mpm.m
Type: text/x-objcsrc
Size: 1501 bytes
Desc: not available
URL: <http://lists.mercurylang.org/archives/users/attachments/20150516/cf36f356/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: primality_mpm.m
Type: text/x-objcsrc
Size: 5233 bytes
Desc: not available
URL: <http://lists.mercurylang.org/archives/users/attachments/20150516/cf36f356/attachment-0001.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: primes_mpm.m
Type: text/x-objcsrc
Size: 4215 bytes
Desc: not available
URL: <http://lists.mercurylang.org/archives/users/attachments/20150516/cf36f356/attachment-0002.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mp.m
Type: text/x-objcsrc
Size: 2721 bytes
Desc: not available
URL: <http://lists.mercurylang.org/archives/users/attachments/20150516/cf36f356/attachment-0003.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mp_int.m
Type: text/x-objcsrc
Size: 35155 bytes
Desc: not available
URL: <http://lists.mercurylang.org/archives/users/attachments/20150516/cf36f356/attachment-0004.bin>
More information about the users
mailing list