What happened to phobos compile time?
Steven Schveighoffer
schveiguy at gmail.com
Tue Aug 4 12:42:04 UTC 2020
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 that change, a few functions were force-inlined. Most of them
were trivial.
And I don't think these are ones that are used in a lot of places.
Phobos is compiled all-at-once. So you can't explain the slowdown by
multiple instances of compilation.
Has anyone profiled to see where the slowdown is? If I remove the
pragma(inline) from the two functions T_SHA2_0_15 and T_SHA2_16_79, the
compile time comes back to normal.
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.
-Steve
More information about the Digitalmars-d
mailing list