GHC 6.8.1 is impressive!

Seth Kurtzberg seth at
Fri Nov 9 10:33:52 EST 2007

-----Original Message-----
From: glasgow-haskell-users-bounces at
[mailto:glasgow-haskell-users-bounces at] On Behalf Of Peter Hercek
Sent: Friday, November 09, 2007 9:19 AM
To: glasgow-haskell-users at
Subject: Re: GHC 6.8.1 is impressive!

New ghc sped up my small app (~2000 lines) by ~38%. Nice job!
Anyway, my application is a bit slower when compiled with -O2
compared to -01 only (both with ghc 6.6 and 6.8).
Is that normal?

I assume you meant -O1, not -01, in "compared to -01."  :)

It's certainly not necessarily abnormal.  It is well known that one can
create situations where optimizations have a negative impact.

The interesting question is, what are the characteristics of this particular
application that are atypical, and thus appear to cause atypical
optimization behavior?

This type of situation is similar to the situation sometimes seen with
multi-processor machines.  In most cases, if you add processors, you get
better performance.  In some cases the reverse results.  This is because
there is some overhead to multiprocessing, and if a program is structure in
such a way that parallelism is impossible, the multiprocessor overhead
decreases performance and thus, for that particular application, performance
is decreased.

To continue the analogy, in most cases one can make minor modifications that
will allow the application to use available parallelism.  It is likely that
small modifications to your program would allow it to take advantages of the
increased optimization provided by -O2.

So, as I said, it will be very interesting to discover the reason for the
behavior you are experiencing.  It might point to ways to make small code
modifications to your application to increase performance.  It might point
to ways to improve the optimization.

That's all premature of course.  We don't know enough, to cite one quick
example we don't know whether the optimization behavior is related to ghc
behavior or to gcc behavior (although, of course, even if it is related to
gcc behavior there could be interesting code generation issues).  It would
be fun to discover the details.

Seth Kurtzberg
Software Engineer
Specializing in Security, Reliability, and the Hardware/Software Interface


Lennart Augustsson wrote:
> I'd like to second that.  6.8 is quite an improvement.  Well done!

Glasgow-haskell-users mailing list
Glasgow-haskell-users at

More information about the Glasgow-haskell-users mailing list