[Haskell-cafe] GHC: Policy on -O flags?

Brandon Allbery allbery.b at gmail.com
Tue Aug 27 16:12:47 UTC 2019


I think at first you just give it a -f flag, and let experience determine
whether it should be part of -O or -O2.

On Tue, Aug 27, 2019 at 12:10 PM Andreas Klebinger <klebinger.andreas at gmx.at>
wrote:

> Hello ghc-devs and haskell users.
>
> I'm looking for opinions on when an optimization should be enabled by
> default.
>
> -O is currently the base line for an optimized build.
> -O2 adds around 10-20% compile time for a few % (around 2% if I remember
> correctly) in performance for most things.
>
> The question is now if I implement a new optimization, making code R%
> faster but slowing
> down the compiler down by C% at which point should an optimization be:
>
> * Enabled by default (-O)
> * Enabled only at -O2
> * Disabled by default
>
> Cheap always beneficial things make sense for -O
> Expensive optimizations which add little make sense for -O2
>
> But where exactly is the line here?
> How much compile time is runtime worth?
>
> If something slows down the compiler by 1%/2%/5%
> and speeds up code by 0.5%/1%/2% which combinations make sense
> for -O, -O2?
>
> Can there even be a good policy with the -O/-O2 split?
>
> Personally I generally want code to either:
> * Typecheck/Run at all (-O0, -fno-code, repl)
> * Not blow through all my RAM when adding a few Ints while developing: -O ?
> * Make a reasonable tradeoff between runtime/compiletime: -O ?
> * Give me all you got: -O2 (-O99999)
>
> The use case for -O0 is rather clear, so is -O2.
> But what do people consider the use case for -O
>
> What trade offs seem acceptable to you as a user of GHC?
>
> Is it ok for -O to become slower for faster runtimes? How much slower?
> Should all new improvements which might slow down compilation
> be pushed to -O2?
>
> Or does an ideal solution add new flags?
> Tell me what do you think.
>
> Cheers,
> Andreas Klebinger
>
> _______________________________________________
> ghc-devs mailing list
> ghc-devs at haskell.org
> http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs
>


-- 
brandon s allbery kf8nh
allbery.b at gmail.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/haskell-cafe/attachments/20190827/899db856/attachment.html>


More information about the Haskell-Cafe mailing list