Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Do aggressive optimizations make sense?
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Gentoo Chat
View previous topic :: View next topic  
Author Message
L1NTHALO
n00b
n00b


Joined: 27 Aug 2024
Posts: 16

PostPosted: Wed Oct 30, 2024 11:41 am    Post subject: Do aggressive optimizations make sense? Reply with quote

There are many options to "optimize" gentoo and I've been wondering which one makes the most sense. You hear a lot of different advice, so it would be great to hear from someone who knows

I myself am on the extreme end of aggressive optimizations. I have set -march=native, -pipe, -flto, -O3, -fraphite-identity, -floop-nest-optimize, -fno-semantic-interposition, -fipa-pta and -fdevirtualize-at-ltrans globally, enabled lto, pgo and graphite USE Flags and compiled my kernel with clang ThinLTO.

The question is does this even make sense? I've heard that O3 is not necessarily always beneficial and that you should only use lto on packages that have the use flag. Am I doing more harm than good by setting all these flags? What about graphite, does it make sense to enable globally?

Would it be better to just use safe CFLAGS and maybe graphite globally and only set lto for packages that support it? What about Kernel LTO?

Does it all even make a difference?
Back to top
View user's profile Send private message
szatox
Advocate
Advocate


Joined: 27 Aug 2013
Posts: 3402

PostPosted: Wed Oct 30, 2024 12:02 pm    Post subject: Reply with quote

Quote:
You hear a lot of different advice, so it would be great to hear from someone who knows
This is because people have a lot of different needs, purposes, and priorities.
Optimization is about trade-offs, you sacrifice a thing you don't care about to maximize something of greater value to you.
-O0 is optimal when going for short compilation time.
Back in the days when games would be printed in magazines, when you'd have to type the code into your computer before you could play, optimization meant minimizing the size of the source code.
Inlining function calls speeds up execution by reducing number of jumps, but increases the size of executable.

Basically, figure out what do you want first, and THEN think how to get there. In many cases just accepting the defaults is optimal, because it saves you time you'd wast eon research.
_________________
Make Computing Fun Again
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Gentoo Chat All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum