compiling always generates fast code?

Chuck Swiger cswiger at mac.com
Mon Feb 26 02:47:49 UTC 2007


deeptech71 at gmail.com wrote:
> Do you get processor-specific code when you do buildworld and 
> buildkernel, particularly on a -RELEASE?

No, not unless you've configured the kernel Makefile and /etc/make.conf to 
include processor-specific CFLAGS.  See /usr/share/examples/etc/make.conf.

> Does building from ports always automatically optimize code (vs packages)?

Both ports and packages are optimized at the default level of "-O", unless you 
set it otherwise.  The kernel & world are known to be safe building using:

   -O2 -fno-strict-aliasing

> Do I need to strip some files after the compilation (world, kernel, 
> ports) to get the absolute maximum performance?
> 
> Any other tips to speed up executables?

Sure, benchmark performance and make sure you run any self-testing routines 
("make test" or "make check", usually) when you experiment with non-default 
optimizations.

Pay attention to whether you obtain significant gains by using non-default 
optimizations, because the answer generally varies in different situations and 
on different CPU types.

-- 
-Chuck


More information about the freebsd-questions mailing list