News for hackers. Stuff that matters.
Re:Let the Compiler Do the Work by flohofwoe on Tuesday January 07, 2020 @07:57AM (#21979480)
...or link with LTCG / LTO, this automatically considers all functions for inlining across compilation units, no matter if they are marked as inline or not. For C code this is preferable IMHO because it allows to keep declaration and implementation code strictly separate, inline functions muddy that line because they must live in headers.
Re:Let the Compiler Do the Work by pingyong on Tuesday January 07, 2020 @08:06AM (#21979549)
While I vastly prefer this workflow wise, for large projects it can increase compile time drastically. https://lwn.net/Articles/744507/

For projects that will never have more than ~1 million LOC it's probably fine. Less than ~100K, definitely preferable.

Re:Let the Compiler Do the Work by mikepurvis on Tuesday January 07, 2020 @10:36AM (#21980911)
What about ThinLTO? The idea of having a overnight full build that creates some kind of cache which incremental builds throughout the day can use to do fast whole-binary LTO seems like the best of both worlds.

Basically just wondering if anyone has first hand experience using this kind of thing on a large project.

Re:Let the Compiler Do the Work by rwem on Tuesday January 07, 2020 @11:28AM (#21981450)
ThinLTO was written by people responsible for peak optimization of very large programs at Google. I honestly can’t call it “fast” but it’s a lot faster than GCC LTO. You normally only peak-optimize your release builds so it’s not like developers are sitting there counting the seconds.
Re:Let the Compiler Do the Work by derefr on Tuesday January 07, 2020 @12:34PM (#21982229)
> You normally only peak-optimize your release builds so it’s not like developers are sitting there counting the seconds.

Sometimes you do want to debug a release build because the optimizations have gone wrong, though. In that case, it's helpful if release builds build quickly, and especially if they rebuild quickly as you turn various sub-optimization flags on and off.

Re:Let the Compiler Do the Work by rwem on Tuesday January 07, 2020 @12:45PM (#21982381)
Yes, and sometimes you want to validate a performance change and you need the release build to run in the benchmark fixture, and then it's irritating that the build takes forever but what can be done? ThinLTO's real benefit is that it uses so much less memory than legacy LTO and can be applied to larger programs (like Chrome).
Re:Let the Compiler Do the Work by Avamander on Tuesday January 07, 2020 @08:32AM (#21979718)
Those large projects benefit the most from LTO as well though.