This is known behaviour of gcc. It doesn't just happen with Haskell
programs.
Could you explain.
Just that gcc -O2 (and higher) isn't guaranteed to produce better code than
gcc -O. I've seen it reported several times, but I couldn't give you any
concrete examples I'm afraid. I know
George Russell wrote:
[snip]
It won't be so hard to
speed up GHC later if that becomes important.
Since this has been disputed, here are three ways I believe you could speed up
GHC without rewriting the whole of it. I would be surprised if you didn't get
at least twice the speed, and you could
(1) (I've suggested this before.) Make GHC access interface
files more
efficiently. If you do top and truss (on a Sun system)
you will find
that GHC has to read in a huge number of interface files,
mainly from
the prelude but also from other places, to get going.
This