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

Paolino paolo.veronelli at gmail.com
Sat May 19 12:44:12 CEST 2012


Hello,

I would like to add questions to yours. I'm not sure that C++ programs
are same performance as C actually, so I can have a bad logic.

How much is hard to port a haskell program to C ?
If it will become harder and harder, (i.e. for parallelizations) than
it's fair to choose haskell for performance, but if it's not, I think
it's hard to think that such a high level language could ever compile
down to something running faster than its port to C.

Many of the abstractions used for nice haskell code are based on
boxing values, so we have to take away all the boxing to make it run
faster, and so we are porting to C.

Will hardware really go for hundreds of cores ?
If yes than all languages supporting simple parallelization will be
used to code, but this will not make C  slower, just more difficult to
use in contests.

Also a leading haskell point is , how does it take to make a correct
code, which can be performance in the wild.

So it makes some sense to choose haskell for performance to me, but
not to try to compete in sequential algorithmic performance, with the
exception for who do it to learn what is behind the abstractions that
makes their code slow and not compile down to perfect C.

paolino

P.S. The performance problems are actually learning haskell
programming abstractions and the intuition development on when to use
each.



2012/5/6 Janek S. <fremenzone at poczta.onet.pl>:
> Hi,
>
> a couple of times I've encountered a statement that Haskell programs can have performance
> comparable to programs in C/C++. I've even read that thanks to functional nature of Haskell,
> compiler can reason and make guarantess about the code and use that knowledge to automatically
> parallelize the program without any explicit parallelizing commands in the code. I haven't seen
> any sort of evidence that would support such claims. Can anyone provide a code in Haskell that
> performs better in terms of execution speed than a well-written C/C++ program? Both Haskell and C
> programs should implement the same algorithm (merge sort in Haskell outperforming bubble sort in
> C doesn't count), though I guess that using Haskell-specific idioms and optimizations is of
> course allowed.
>
> Jan
>
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe



More information about the Haskell-Cafe mailing list