[Haskell-cafe] Re: Write Haskell as fast as C. [Was: Re: GHC
andrewcoppin at btinternet.com
Fri May 16 14:56:36 EDT 2008
Don Stewart wrote:
> I've written an extended post on how to understand and reliably optimise
> code like this, looking at it all the way down to the assembly.
> The result are some simple rules to follow for generated code as good
> as gcc -O2.
A well-written piece, as always.
My feelings are ambivilent. On the one hand, it's reassuring that such
good performance can be obtained without resorting to calling C,
explicit unboxed types, GHC-specific hacks, strictness annotations,
manual seq calls, strange case expressions, or really anything remotely
odd. It's fairly plain Haskell '98 that most beginners would be able to
read through and eventually understand. And yet it's fast.
On the other hand, this is the anti-theisis of Haskell. We start with a
high-level, declarative program, which performs horribly, and end up
with a manually hand-optimised blob that's much harder to read but goes
way faster. Obviously most people would prefer to write declarative code
and feel secure that the compiler is going to produce something efficient.
If the muse takes me, maybe I'll see if I can't find a less ugly way to
More information about the Haskell-Cafe