Very nice work by the author but I am bit concerned about the attitude that "optimization is already good enough, and additional optimizations have the unfortunate trend to trade large compile-time increases for very minor improvements".
I would let my compiler run for a day for minor improvement in the release build to try all kind of inlining decision for example. I really hope that any compiler speed optimizations that results in runtime regressions will be reserved to -O0 and -O1. Or maybe we need an -O4 for the kind of extremely slow optimizations.
Generally my experience has been that release builds don't feel significantly slower. I did this completely none scientific test with the code I happen to have to have open right now and the debug builds takes about 4.5 seconds in -O0 Clang and the -O3 link time optimization release build takes about 5.5. With the MSVC the difference is even smaller. btw I am not doing anything crazy with templates, I am generally very concerned about header includes and I am linking dynamically for development builds.
I don't really know what the compiler is doing but 4.5 seconds is WAY too long for these couple source files, it's less than 10 000 source lines being recompiled.
My impression is that optimizations are already "too fast", it's just that general compilation somehow is really slow. What if maybe ironically Clang's own release could get 5% faster with an "aggressive optimization" switch that just tries a bunch of stuff over 24h?
78
u/[deleted] May 10 '20 edited May 10 '20
Very nice work by the author but I am bit concerned about the attitude that "optimization is already good enough, and additional optimizations have the unfortunate trend to trade large compile-time increases for very minor improvements".
I would let my compiler run for a day for minor improvement in the release build to try all kind of inlining decision for example. I really hope that any compiler speed optimizations that results in runtime regressions will be reserved to -O0 and -O1. Or maybe we need an -O4 for the kind of extremely slow optimizations.
Generally my experience has been that release builds don't feel significantly slower. I did this completely none scientific test with the code I happen to have to have open right now and the debug builds takes about 4.5 seconds in -O0 Clang and the -O3 link time optimization release build takes about 5.5. With the MSVC the difference is even smaller. btw I am not doing anything crazy with templates, I am generally very concerned about header includes and I am linking dynamically for development builds.
I don't really know what the compiler is doing but 4.5 seconds is WAY too long for these couple source files, it's less than 10 000 source lines being recompiled.
My impression is that optimizations are already "too fast", it's just that general compilation somehow is really slow. What if maybe ironically Clang's own release could get 5% faster with an "aggressive optimization" switch that just tries a bunch of stuff over 24h?