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

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

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

Andreas Klebinger
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
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs
Reply | Threaded
Open this post in threaded view
|

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

Artem Pelenitsyn
Thanks, Andreas!

I believe, the wiki modestly tries to suggest this here:
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 <[hidden email]> 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
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs

_______________________________________________
ghc-devs mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs