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

Andreas Klebinger klebinger.andreas at gmx.at
Sat Aug 4 22:57:36 UTC 2018


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


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-devs/attachments/20180805/c4a49c3c/attachment.html>


More information about the ghc-devs mailing list