[Haskell-cafe] Can Haskell outperform C++?

Paulo Pocinho pocinho at gmail.com
Sat May 19 00:53:33 CEST 2012

I've been following the topic in both threads. Very nice discussion.

On 18 May 2012 18:51, Isaac Gouy <igouy2 at yahoo.com> wrote:
> Moreover, being absolutely sure that the algorithms are in some sense
> "identical" might make comparison pointless - for example, when the same assembly
> is generated by gcc from a C program and gnat from an Ada program.

Suppose we take the most efficient algorithm, in terms of time and
space. The demonstrations given before this post indicate the language
can be more important than the algorithm. There are two different
takes on the situation.
On one hand we have time and space. On the other, man-hours and
reliability. Both languages deal with this ratio.

> But we're still going to ask - Will my program be faster if I write it in language X? - and we're
> still going to wish for a simpler answer than - It depends how you write it!

Change that question to: Will my language be faster if I write program X?

Good C++ implementations are easy to find. However, everything is
exposed. De-bugging is taken for granted. Unless everyone in a team
follows some strict practice, productivity may be at risk. It is more
difficult to provide reliability (i.e. programs as proofs [1]). It is
everywhere - that only increases probability to find more optimized
algorithms in C++ libraries.

The Haskell implementation enforces an interface to the programmer
(the low level time-space management, i.e. GC, IO monads,
parallelism). Improvements in implementation increase efficiency of
the program (i.e. optimization in standard libraries [2]). Risk of
damaging productivity is low.

Taking that you could derive one efficient algorithm down to assembly,
the fastest language is a matter of implementation. Then, in equal
grounds, it's rather easy choice.

[1] http://homepages.inf.ed.ac.uk/wadler/papers/frege/frege.pdf
[2] https://groups.google.com/d/msg/haskell-cafe/KIxGd4babKE/J7LV3EGtutsJ

More information about the Haskell-Cafe mailing list