PSA: You likely want to use -O2 for the stage1 compiler.

Artem Pelenitsyn a.pelenitsyn at gmail.com
Sat Aug 4 23:27:19 UTC 2018


Thanks, Andreas!

I believe, the wiki modestly tries to suggest this here:
https://ghc.haskell.org/trac/ghc/wiki/Building/Using#Workingonanoptimizedstage2compiler.
Maybe, it should be more insistent, e.g., by adding these numbers or moving
the advice to a more visible place. Not sure.

--
Best, Artem

On Sun, 5 Aug 2018 at 01:58 Andreas Klebinger <klebinger.andreas at gmx.at>
wrote:

> I've wondered for a good while if using O2 on stage1 might be worth it.
>
> So I did some measurements and it should be worth it for most cases.
>
> For a single "quick" flavour build they are more or less on equal footing.
> If you rebuild stage2 multiple times reusing stage1 it will be faster.
> If you build stage2 with optimizations/profiling it will be faster.
>
> Below are the timings using "time make -j9" for a quick build.
> I forgot to write down the seconds as I didn't expect them to be so close.
> But it is what it is.
>
> Timings stage1 options O1 vs O2, quick build after make clean:
>
> stage1 opt | time (wall) | time (user)
> -O1        |   13m       |   53m
> -O2        |   13m       |   51m
>
> I've also run the numbers for a optimized stage2 compiler a while ago,
> where stage1 with O2 was faster.
> But I no longer have these numbers around.
>
> So it seems safe to say one should use O2 if either:
> * stage2 is built with optimizations
> * you freeze stage1 and reuse it while working on stage2
>
>
> _______________________________________________
> ghc-devs mailing list
> ghc-devs at haskell.org
> http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-devs/attachments/20180805/2e9763c3/attachment.html>


More information about the ghc-devs mailing list