Optimize your Gentoo
First,if you have more than one Gentoo machine,try DistCC.
But since I only got one,we gonna ignore DistCC for now.
ccache is a great tool which will speed up compilation process,first emerge it.
emerge --ask ccache
And enable it with your make.conf
Add this line to it.
Next tool is prelink.prelink will pre-link application’s dynamic library,eventually cut their start-up time.
Emerge it as well.
emerge --ask prelink
And update your environment.
Then your system should be ready to go.
But we need do little job for old pre-compiled application in /opt,since they can’t be prelinked,we need tell prelink not to attempt to prelink them.
Put this line into it.
And prelink your system.
Make sure you have some space left on drive,otherwise,this may fail.
Now let’s focus on CFLAGS and other flags in make.conf,first we need find proper -march and -mtune.
As I mentioned in this blog ,use following command to obtain them.
gcc -v -E -x c -march=native -mtune=native - < /dev/null 2>&1 | grep cc1 | perl -pe 's/ -mno-\S+//g; s/^.* - //g;'
This should produce a line of CFLAGS.But we only need -march and -mtune,add/modify them in make.conf.
CFLAGS="-march=haswell -mtune=haswell -O2 -pipe"
Don’t worry about -msse flags and other feature flags,they will apply to CFLAGS automatically as long as the system is using the correct -march .
Okay,now your system is fully optimized!
This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.