[m-users.] Too Slow

Paul Bone paul at bone.id.au
Wed Apr 15 09:58:55 AEST 2015

On Tue, Apr 14, 2015 at 07:39:02PM +0200, Matthias Guedemann wrote:
> Hi Robert,
> > -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.
> In my opinion, the principal reason for this is that the Mercury
> implementation for big integers is written in pure Mercury. In contrast,
> Haskell calls GMP via FFI. GMP is a highly optimized library written in
> C. For the other languages, it depends on the implementation, but very
> likely they also use GMP or a similar library directly. The downside of
> using GMP or another library is the added dependency, of course.

If anyone wanted to contribute a binding to libgmp that we can place in the
extras directory that would be okay with me *hint hint*.

Some smart people have already done the hard work and written libgmp, it'd
be great to use it when we want big integers fast.  And if it were in extras
then it wouldn't become a dependency of Mercury itself or Mercury programs
that don't use the gmp binding.

Paul Bone

More information about the users mailing list