What happened to phobos compile time?
Andrei Alexandrescu
SeeWebsiteForEmail at erdani.com
Tue Aug 4 15:04:51 UTC 2020
cc Walter
The functions Ch and Maj are the culprits:
https://github.com/dlang/phobos/blob/master/std/digest/sha.d#L318
Each is responsible for about half of the slowdown. If those are not
inlined the build speed is back to the previous.
The templates are only instantiated with uint and ulong, but this didn't
help any:
uint Maj(uint x, uint y, uint z) { return (x & y) | (z & (x ^ y)); }
uint Ch(uint x, uint y, uint z) { return z ^ (x & (y ^ z)); }
ulong Maj(ulong x, ulong y, ulong z) { return (x & y) | (z & (x ^ y)); }
ulong Ch(ulong x, ulong y, ulong z) { return z ^ (x & (y ^ z)); }
In turn, these functions are called from the inline functions
T_SHA2_0_15 and T_SHA2_16_79. Turning inlining off on T_SHA2_16_79
instead again brings build speed back.
Fix: https://github.com/dlang/phobos/pull/7577
More information about the Digitalmars-d
mailing list