On 28 June 2017 at 23:15, Mike via D.gnu <d.gnu@puremagic.com> wrote: > ------------------------------------------------------------------------- > The vast majority of time is spent in "phase opt and generate". A few > observations: > > * Elapsed time isn't much different between -O3 and -O2 -finline-functions > * -O2 -finline-functions gave me a smaller binary :)
I did say that -Os (optimize for size) is practically identical to this. So I'm not surprised. ;-) And yeah, one of the big differences between -O2 and -O3 is that when it comes to inlining, -O3 mostly disregards size and cost heuristics. > * -O0 reduced time significantly, but "phase opt and generate" still takes > an awfully long time relative to everything else > > What exactly is "phase opt and generate"? I'm assuming "opt" means > optimizer, but why is it taking such a long time even with -O0? Maybe it's > the "generate" part of that that's the most significant. > Phase opt and generate is the topl-evel timer for the entire "backend" compilation phase. I was expecting to see more of a breakdown of individual passes. > With -O0 there's still quite a few things enabled, so maybe I'll start > appending a "-fno" to each one and see if I can find a culprit. > A thought just occurred to me, you are compiling the entire program + object.d right? Nothing else will link/be linked to the binary? If that is the case, you should definitely compile with -fwhole-program. I suspect that may cut down your compilation time by half or even more. Regards, Iain.