[Haskell-cafe] Can Haskell outperform C++?
Ryan Newton
rrnewton at gmail.com
Fri May 11 02:44:09 CEST 2012
>
> through the trouble of writing my algorithms in C/C++, but simple-minded
> people often have a desire to get the best performance possible, in
> which case you really want to use C, C++, Fortran or whatever high level
> assembler language you like.
>
I think this is a bit of an unfair accusation ("simple-minded").
Performance is only relevant to certain domains, sure. But program
performance is an entire *industry*. And I'd argue it's of massive
importance to the world at large. Intel has an army of "AE"s (application
engineers) that go out to other companies to make applications perform
better. There are plenty of compute bound industries -- i.e. movie
companies are limited by what kind of frame they can render in ~24 hrs;
sequencing centers are limited by certain very slow bioinformatics
algorithms; you can look almost anywhere you like for examples.
As a community I think we have to face the fact that writing the hot inner
loop of your application as idiomatic Haskell is not [yet] going to give
you C/Fortran performance off the bat. Though in some cases there's not
really anything stopping us but more backend/codegen work (I'm thinking of
arithmetically intensive loops with scalars only). For example, the
following Mandel kernel is in many ways the *same* as the C version:
https://github.com/simonmar/monad-par/blob/662fa05b2839c8a0a6473dc490ead8dd519ddd1b/examples/src/mandel.hs#L24H
We have the types; we've got strictness (for this loop); but the C version
was 6X faster when I tested it.
-Ryan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20120510/13253157/attachment.htm>
More information about the Haskell-Cafe
mailing list