What happened to phobos compile time?

Stefan Koch uplink.coder at googlemail.com
Tue Aug 4 13:51:13 UTC 2020


On Tuesday, 4 August 2020 at 12:42:04 UTC, Steven Schveighoffer 
wrote:
> On 8/4/20 12:41 AM, Mathias LANG wrote:
>> On Tuesday, 4 August 2020 at 03:54:53 UTC, RazvanN wrote:
>>> Hello everyone!
>>>
>>> I just tried compiling phobos on machine to get updated with 
>>> the latest changes and I noticed an explosion in compile 
>>> time. On my machine it takes roughly 5 minutes (!!!) to 
>>> compile it while last year it took somewhere around 15-30 
>>> seconds. Does anyone know what has caused this serious 
>>> performance regression?
>>>
>>> Thanks for answers,
>>> RazvanN
>> 
>> Welcome to the wonderful world of DMD inliner, we hope you 
>> enjoy your stay.
>> 
>> ```
>> $ make -f posix.mak -j8  88.90s user 0.89s system 99% cpu 
>> 1:30.25 total
>> $ git show HEAD | head -n 5
>> commit 2f0ea3fdedc2889b63f266de908cb8658ce98ec9
>> Author: Walter Bright <walter at walterbright.com>
>> Date:   Tue Jul 21 01:12:35 2020 -0700
>> 
>>      sha: inline critical functions
>> $ git checkout HEAD^
>> Previous HEAD position was 2f0ea3fde sha: inline critical 
>> functions
>> HEAD is now at e364edfc8 Merge pull request #7561 from 
>> WalterBright/fabs-float
>> $ make -f posix.mak -j8  9.42s user 0.55s system 98% cpu 
>> 10.128 total
>> ```
>

>
> 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.e. fewer functions with larger bodies can take significantly 
more time than more function with smaller bodies.

At least if optimizations are enabled.

If you increase the size of a couple functions by a lot.


More information about the Digitalmars-d mailing list