On Thu, Oct 31, 2024 at 10:15:03AM +0200, drago01 wrote: > On Thursday, October 31, 2024, Jakub Jelinek <jakub@xxxxxxxxxx> wrote: > > > On Wed, Oct 30, 2024 at 10:46:01PM -0400, Neal Gompa wrote: > > > I know the idea of moving to -O3 has been briefly mentioned before in > > > other contexts when we've discussed uplifting the flags, but it looks > > > like Ubuntu is moving to -O3 for Ubuntu 25.04[1]. Is there a reason > > > why we shouldn't consider doing the same for Fedora Linux 42? > > > > Yes, this is a very bad idea. > > > > -O3 significantly increases code size (and the speed up gains aren't really > > guaranteed), which is highly undesirable when the vast majority of code in > > the distro isn't performance critical, the I-cache footprint is then more > > important. > Isn't instruction cache footprint already part of "performance" i.e if > performance is improved it shouldn't matter and vice versa, or what am I > missing? That is not how compilers work, no compiler except toys on trivial short examples try all the possible valid code generations and choose the optimal one (after all, without PGO the compiler doesn't even know what code is hot and what is cold, it can just use some heuristics). Compilers instead choose optimization passes based on the -O? options, where -O3 includes over -O2 possibly expensive optimization passes that aren't always guaranteed to improve performance and are often known to increase code size, changes inlining heuristics etc. Similarly -Os doesn't guarantee smallest possible code size, sometimes -Os code can be even bigger than -O2, though not on average, it simply choses optimizations which generally decrease code size or doesn't enable ones that often increase code size and on micro cost decisions can pick smaller code over larger one (or for -O2/-O3 rather estimated faster sequence over slower one). By using PGO, the compiler is told which parts of code are likely hot, which are likely cold, with what arguments some builtin functions are usually called etc., so the compiler can use better heuristics. Jakub -- _______________________________________________ devel mailing list -- devel@xxxxxxxxxxxxxxxxxxxxxxx To unsubscribe send an email to devel-leave@xxxxxxxxxxxxxxxxxxxxxxx Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/ List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines List Archives: https://lists.fedoraproject.org/archives/list/devel@xxxxxxxxxxxxxxxxxxxxxxx Do not reply to spam, report it: https://pagure.io/fedora-infrastructure/new_issue