GHC compiled program slower with -O1 than -O0
Simon Marlow
simonmarhaskell at gmail.com
Wed Mar 28 04:00:39 EDT 2007
Neil Mitchell wrote:
> Hi Simon
>
>> One thing to check is heap usage and GC time. Does GC time, or
>> residency (both reported by -Sstderr) go up a lot? It's possible
>> that an optimisation is changing space behaviour for the worse.
>
> I've attached the logs for both -O0 (norm) and -O1 (opt), it appears
> that there are 4 times more garbage collections with -O1, so thats
> likely to be it.
>
>> Does it still happen if you use profiling? If so, the profile should
>> narrow down the culprit a lot. That might avoid the need to reproduce
>> it elsewhere.
>
> Profiling with -O1 is faster than -O1 and -O0, so turning on profiling
> fixes whatever is going wrong.
>
> The darcs repo for the code is at:
>
> http://www.cs.york.ac.uk/fp/darcs/catch/
>
> This is the catch_1 directory. Unfortunately it will be a nightmare to
> build...
There are two things that I know of that can cause this. The first is the bug
that affects calendar from nofib:
http://hackage.haskell.org/trac/ghc/ticket/1168
and the second is full-laziness, which can give your program a space leak if you
compile with -O. You'll be able to tell if it's a space leak problem by looking
at the "+RTS -sstderr" output and checking the GC time.
Cheers,
Simon
More information about the Glasgow-haskell-users
mailing list