Re:C++ Headers are Expensive
by vbezhenar on Tuesday January 08, 2019 @02:08AM
(#18853880)
Java JIT-compiler inlines short method calls whenever possible. Though C++ compiler should be able to do the same.
[ Parent
| on HN ]
And they do, when given PGO data, or when doing LTO.
Given this is a topic of slow c++ builds, mentioning LTCG should come with the caveat that it will absolutely destroy your compile times.
It's also not infallible and you might find it difficult to track a regression if introduced by someone silently breaking a heurestic in the optimiser.
Sure, I was only mentioning that it is possible.
However with VC++ it doesn't seem to be that bad, when incremental compilation and linking are enabled.
According to MS[0], LTCG doesn't work with /INCREMENTAL (note /LTCG:INCREMENTAL is different). For my use cases, LTCG is unusable for anything other than our overnight builds.
[0] https://docs.microsoft.com/en-us/cpp/build/reference/ltcg-li...
Thanks for the correction.
That's what happens when I spend most the time on JVM/.NET worlds. :)