-O vs. -O2

Simon Marlow marlowsd at gmail.com
Fri May 7 05:53:53 EDT 2010

On 05/05/2010 12:24, Roman Leshchinskiy wrote:
> Whenever I do cabal sdist on one of my projects, I get this warning:
> Distribution quality warnings: 'ghc-options: -O2' is rarely needed.
> Check that it is giving a real benefit and not just imposing longer
> compile times on your users.
> This finally got me curious and I did a nofib run to compare -O to
> -O2. The results are below (this is with the current HEAD).

What were the compile-time results?

We really need to bump all the runtimes in nofib or switch to using
Criterion.  The runtime figures are pretty useless.  Note that you can
run with 'make mode=slow' which will use larger inputs for some, but not
all, of the programs.

> Is there a real-world example of -O2 causing significantly longer
> compile times without providing a real benefit? If not, would it
> perhaps make sense for Cabal to use -O2 by default or even for GHC to
> make the two flags equivalent?

Maybe, let's see what the compile times are like.


More information about the Glasgow-haskell-users mailing list