CPUTYPE and friends, from 'make.conf' benchmark

rank1seeker at gmail.com rank1seeker at gmail.com
Sat Dec 10 10:54:59 UTC 2011


My home server was also built with 'native' and it's unixbench score was:
231.3 (24.6 min)

# /bin/sh -c "gcc -v -x c -E -mtune=native /dev/null -o /dev/null 2>&1 | grep mtune | sed -e 's/.*mtune=//'"
athlon-4

Here it didn't return 'generic'

Just out of curiosity, I've removed 'native' and left only 'CPUTYPE?=athlon-xp'
After rebuild of OS, it's unixbench score is now:
319.8 (22.4 min)

That is a 38.26%, global speed gain!
Now I'm 100% sure, 'native' should always be avoided!


> It is acceptable to set CPUTYPE and to append certain flags to CFLAGS
> in make.conf, and CPUTYPE is used in many ports for
> architecture-dependent build options.

Default CFLAGS are are '-O2 -pipe'
Which are recommended and proven to be safe?


> The use of CPUTYPE usually has a relatively modest affect on general
> benchmarks in the base system, because a lot of code there is
> intentionally generic, and is compiled with an older toolchain using
> conservative flags, so aggressive optimizations that can take fuller
> advantage of CPU extensions are not used.

I believe because OS stability, is a top priority.

> However, CPUTYPE can have a dramatic affect on certain applications
> when used with appropriate compiler flags (-O3, etc.), particularly
> those in some ports.

So, CPUTYPE is mainly for boosting performance of ported apps.
Regarding compiler flags (-O3, etc.) I use them, only if port offers them.

> 
> b.
> 

Domagoj Smolčić


More information about the freebsd-hackers mailing list