News for hackers. Stuff that matters.
Re:Going Faster by Duplicating Code by lifthrasiir on Wednesday October 11, 2023 @06:53AM (#37842929)
Because i) not all programs benefit tremendously from -O3 and ii) it adds to the compile time and binary size? It would be great to have some optimization level between -O2 and -O3 so that only portions that have a potential to be improved more than, say, 5% are compiled using -O3. In fact the existence of `#pragma GCC optimize` does suggest that this might be possible today with some heuristics... (Or use PGO, which will have the same effect. But PGO is still a novelty in 2023.)
Re:Going Faster by Duplicating Code by glandium on Wednesday October 11, 2023 @07:10AM (#37843053)
Re:Going Faster by Duplicating Code by KeplerBoy on Wednesday October 11, 2023 @07:51AM (#37843324)
you can manually set the optimizations (and order of optimizations) you want. -O3 ist just a predefined set of optimizations.
Re:Going Faster by Duplicating Code by lifthrasiir on Wednesday October 11, 2023 @07:58AM (#37843378)
But it is not portable among compilers (for example, both GCC and Clang support SLP-based autovectorization but with different flags). -O# is one of a few flags that have roughly same meaning across many compilers.