[mercury-users] How efficient is mercury?

Maurizio Colucci seguso.forever at tin.it
Fri Apr 23 02:27:16 AEST 2004

On Tuesday 13 April 2004 03:00, Ralph Becket wrote:
> Maurizio Colucci, Sunday, 11 April 2004:
> > Hi everybody,
> >
> > Could someone please tell me how efficient is Mercury compared to
> > Objective Caml? I need to write a videogame (I will be writing some
> > predicates in C for interfacing with Opengl and Qt).
> That's a tricky question to answer.  First off, please *don't* use Doug
> Bagley's now-defunct "Great Computer Programming Language Shootout" web
> site to compare languages: the benchmark implementations for some
> languages (e.g. many of the Mercury ones) are somewhat naive, depending
> upon the implementer's familiarity with the language, and in many cases
> the site even compares different algorithms with different complexities
> (although you have to read the source code to see that this is the
> case.)

Thanks for the insighful reply. I have eventually chosen Mercury, and I am 
amazed at how many errors in my old prolog code I discovered :-)

> The main difference between OCaml and Mercury is that Mercury is a
> purely declarative language whereas OCaml makes it easy to mix
> imperative and functional programming styles. 

And this is one of the reasons why I don't like OCaml.

> The Mercury philosophy is 
> that combining the two styles makes it more likely that programs will
> contain bugs (it's much harder for the compiler to automatically
> identify errors), can inhibit optimisation (for similar reasons), and
> can reduce reusability (shared state has a tendency to spread throughout
> a program.)  That said, Mercury does allow you to embed impure code in
> your program provided you explicitly label it as such.  Mercury also has
> a world class foreign language interface and works very well with a
> number of C compilers, including Visual C.  

Do you suggest I use the new or the old interface for calling C predicates?

> You can use imperative 
> structures such as arrays and pointer graphs in Mercury, but being
> purely declarative means that doing so incurrs some syntactic overhead
> (i.e. your programs will be a little longer, but should run just as
> quickly.)

I don't want to... otherwise I'd use C#.

> In terms of raw performance, I would expect Mercury and Clean to be very
> close to one another, 

That's very good news.

Thanks again!

mercury-users mailing list
post:  mercury-users at cs.mu.oz.au
administrative address: owner-mercury-users at cs.mu.oz.au
unsubscribe: Address: mercury-users-request at cs.mu.oz.au Message: unsubscribe
subscribe:   Address: mercury-users-request at cs.mu.oz.au Message: subscribe

More information about the users mailing list