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

Bardur Arantsson spam at scientician.net
Wed May 16 21:57:40 CEST 2012


On 05/16/2012 09:02 PM, Gregg Lebovitz wrote:
> Isaac,
> 
> I was looking at the debian coding contest benchmarks referenced by
> others in this discussion. All of the benchmarks algorithms, appear to
> be short computationally intensive programs with a fairly low level of
> abstraction.
> 
> In almost all examples, the requirement says: you must implement the X
> functions as implemented in Java, or C#, or C++. The k-nucleotide even
> specifies a requirement to use an update a hash-table.
> 
> I wonder if someone here could come up with a set of benchmarks that
> would out perform C++.
> 

That's easy:

> let ones = 1 : ones
> take 5 ones
[1,1,1,1,1]

I'm not sure how much C++ code you'd have to write to produce the
correct answer without butchering the intent too much, but the naïve
translation to C++ loops infinitely. Obviously Haskell is infintely
better than C++!11111oneone!

> Interesting that you would focus on this one comment in my post and not
> comment on one on countering the benchmarks with a new criteria for
> comparing languages.

Comparing languages is a highly non-trivial matter involving various
disciplines (including various squidgy ones) and rarely makes sense
without a very specific context for comparison.

So the short answer is: mu. Discovering the long answer requires a
lifetime or more of research and may not actually result in an answer.

Regards,




More information about the Haskell-Cafe mailing list