Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Does it make sense to rebuild everything for performance?
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Installing Gentoo
View previous topic :: View next topic  
Author Message
lquenti
n00b
n00b


Joined: 10 Dec 2017
Posts: 16

PostPosted: Tue Jul 23, 2024 7:08 am    Post subject: Does it make sense to rebuild everything for performance? Reply with quote

Hi,
I am going back to gentoo for performance reasons, mainly for the CPU specific optimizations. For that, I have set -march="native", but this obviously doesn't apply to the already compiled packages within stage3.
I saw in the forum that it is quite trivial to recompile everything. So

1. Does it actually increase overall performance? How significant? (5% would be plenty of a reason)
2. Is it stable to compile everything with native CPU target? Since, according to the handbook, other stuff like O3 is not.

Best Regards
Lars
Back to top
View user's profile Send private message
pietinger
Moderator
Moderator


Joined: 17 Oct 2006
Posts: 4841
Location: Bavaria

PostPosted: Tue Jul 23, 2024 1:37 pm    Post subject: Reply with quote

First of all, let me say that an “emerge -e world” CAN bring advantages. But possibly in a different way than you think. Recompiling everything is also a check that all your settings for Portage are correct. It was also necessary for the conversion from 17.1 profiles to 23.0 profiles (*).

Compiling all programs with the CURRENT gcc can be advantageous; therefore you should first check whether you already have the current gcc active (“gcc-config -l”). If necessary, you should do this:
Code:
# emerge -1uDv gcc
# emerge -c
# emerge -e -X gcc @world


lquenti wrote:
1. Does it actually increase overall performance? [...]

No. Everything that communicates with your hard disk will not become faster; neither will access to the main memory (perhaps minimally due to better utilization of the CPU caches). Only calculations within the program can be faster than before; this mainly affects computationally intensive applications, such as scientific calculations, compression routines (video!), or a chess engine. If a program needs a total of 2,000 ms (2 seconds) to load something from the hard disk, then you can assume that approx. 1,990 ms is waiting for the transfer from the hard disk and only 10 ms are calculations. If you can then bring these 10 ms down to 9 ms (10%), you will not notice any difference between 2,000 ms and 1,999 ms.

lquenti wrote:
2. Is it stable to compile everything with native CPU target? [...]

Normally this is correct, but there is one exception: Intel CPUs that have P- and E-cores can cause problems; here it is better to set the CPU architecture directly (example: I have an i9-13900K and have set the following in my make.conf: COMMON_FLAGS=“-march=raptorlake -O2 -pipe”).

lquenti wrote:
[...] other stuff like O3 is not.

Yes.

My recommendation is: Do it, but don't expect too much.


*) paragraph 16 of https://www.gentoo.org/support/news-items/2024-03-22-new-23-profiles.html
_________________
https://wiki.gentoo.org/wiki/User:Pietinger
Back to top
View user's profile Send private message
lekto
Apprentice
Apprentice


Joined: 20 Sep 2014
Posts: 198
Location: Ancient Rome

PostPosted: Tue Jul 23, 2024 1:47 pm    Post subject: Reply with quote

lquenti wrote:
1. Does it actually increase overall performance? How significant? (5% would be plenty of a reason)

This depends on your CPU, there are some benchmarks on Phoronix, e.g.:
https://www.phoronix.com/review/ubuntu-x86-64-v3-benchmark
https://www.phoronix.com/review/cachyos-x86-64-v3-v4

lquenti wrote:
2. Is it stable to compile everything with native CPU target? Since, according to the handbook, other stuff like O3 is not.

I've been using Gentoo for 10 years and don't remember any broken packages when building as native. I'm usually rebuilding stage 3 early as a stress test. This way, I once found early that my SD card was broken.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Installing Gentoo 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