[Haskell-cafe] Re: speed: ghc vs gcc

Louis Wasserman wasserman.louis at gmail.com
Fri Feb 20 20:16:10 EST 2009


I am no longer sure that this conversation is producing useful information
or a learning experience for any involved party, and suggest it ends.

In the meantime, a brief summary:

   - Straightforward and simple Haskell code, written by an individual aware
   of issues with tail recursion and stream fusion, is frequently within 3x the
   speed of GCC code when compiled with appropriate optimizations in GHC.
   - When performance is an absolute necessity, Haskell code can sometimes
   be manually modified (e.g. with manual loop unrolls) to equal GCC in
   performance.
   - The amount of effort required for manually unrolling loops is greater
   than simply using standard GCC optimizations, and in practice few
   programmers will want to make this extra effort.  For your everyday
   programmer, achieving that sort of performance is typically easier when
   writing in C.
   - If anybody wants a Haskell compiler to achieve GCC-level speeds while
   writing short and concise Haskell, it is preferable to add a ticket with
   examples already written out and exhaustively examined to minimize the
   effort Simon needs to make in working on the problem.  GHC has had
   considerably fewer person-hours devoted to it than GCC, and only additional
   person-hours can improve it.
   - Even though it might not match with the amount of effort an average
   Haskell programmer would put into their code, it is *still* constructive to
   attempt to optimize Haskell code exhaustively and at a low level, if only to
   help us learn what sorts of transformations it would be useful for GHC to do
   automatically.  This sort of information, I imagine, would be of significant
   use to Simon when attempting to improve GHC.

Nobody is opining that everyday Haskell code will compile to code as speedy
as GCC output.  People *are* attempting to find out how Haskell code can be
hacked at a low level to run as fast as GCC code, but not because they're
claiming GHC output is as fast as GCC output.  Rather, they're attempting to
find out
a) what sorts of approaches a really determined Haskell programmer can use
to improve speed
b) the sorts of optimizations a later version of GHC might be able to make,
and
c) what sort of code its optimizer might produce.

This is not being reported as "fair Haskell vs C++ comparison" -- this is a
collaborative effort to *improve* Haskell that was motivated by Bulat's
original comparison.

Can we move on?

Louis Wasserman
wasserman.louis at gmail.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20090220/0a8a0336/attachment-0001.htm


More information about the Haskell-Cafe mailing list