Subject: Re: optimizing compilation of netbsd-current
To: Scott Zahn <scott@xeroxparc.net>
From: Perry E. Metzger <perry@piermont.com>
List: netbsd-help
Date: 09/15/2003 11:14:26
Scott Zahn <scott@xeroxparc.net> writes:
> > Scott Zahn <scott@xeroxparc.net> writes:
> > > Hey all, I'm in the process of upgrading netbsd 1.6 to netbsd-current on
> > > my box.  I really want to optimize the binaries I'm compiling.
> >
> > The system will already -O2 all the binaries you generate. Is there
> > something else you are looking for?
> 
> specifically, I'm looking to set -O3 -march=i486,

Ah. You could, in fact, do that. For example, see the cpuflags package
in pkgsrc.

However, I would recommend against it. It turns out that gcc does a
really horrible job of x86 architecture specific optimizations (at
least in 2.95 -- maybe it does better in gcc 3.3 which we will be
switching to shortly). Also, when you optimize with most of the x86
-march flags, your code grows substantially, which makes the build
break because things like the boot floppies explode.

Anyway, the trick is to set variables in /etc/mk.conf and let them do
what you need done, but I wouldn't do it except in rare
circumstances. It is worthwhile to do CPU specific optimizations for a
few packages, like mplayer and such, which can take advantage of MMX
and similar instructions.

Perry