[m-users.] Too Slow

Delmas Buckley rbuckley at ieee.org
Wed Apr 15 02:38:12 AEST 2015


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/20150414/358263cb/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test_primeFactors.m
Type: application/octet-stream
Size: 1431 bytes
Desc: not available
URL: <http://lists.mercurylang.org/archives/users/attachments/20150414/358263cb/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: primality.m
Type: application/octet-stream
Size: 6236 bytes
Desc: not available
URL: <http://lists.mercurylang.org/archives/users/attachments/20150414/358263cb/attachment-0001.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: primes.m
Type: application/octet-stream
Size: 6589 bytes
Desc: not available
URL: <http://lists.mercurylang.org/archives/users/attachments/20150414/358263cb/attachment-0002.obj>


More information about the users mailing list