What happened to phobos compile time?

Steven Schveighoffer schveiguy at gmail.com
Tue Aug 4 15:06:38 UTC 2020


On 8/4/20 9:51 AM, Stefan Koch wrote:
> On Tuesday, 4 August 2020 at 12:42:04 UTC, Steven Schveighoffer wrote:
>> Looking at uses of those functions I get a total of 80 uses. 
>> Considering the compile time goes from 12 seconds on my system to 92 
>> seconds, that's a full second to inline each call. Something doesn't 
>> add up, it can't be that bad.
> 
> Hmm if those are inlined in a few places then that will bloat the code 
> they were inlinened in.
> 
> Most optimization and code-gen algorithms work on the function as a unit 
> have a super linear relationship to the number of statements and 
> expressions in that function body.

I guess my question is: is it reasonable for the compiler to take an 
additional second per call to inline a function? Maybe it is, but I 
don't know that my experience with inlining matches that.

The nice thing about this change is that it's easy to test what the 
differences are. If you remove the pragma(inline) it's fast. So it 
should be possible to tell where all the extra time is going.

> I.e. fewer functions with larger bodies can take significantly more time 
> than more function with smaller bodies.
> 
> At least if optimizations are enabled.

I don't know if I've ever seen an optimization cause a 1 second increase 
to compile a function. But maybe I'm wrong.

-Steve


More information about the Digitalmars-d mailing list