optimize with -O2 or -O?
Matthew Seaman
m.seaman at infracaninophile.co.uk
Tue Nov 4 00:57:40 PST 2003
On Tue, Nov 04, 2003 at 04:20:41PM +0800, Zhang Weiwu wrote:
> Hello. I'm running 5.1-RELEASE.
>
> I read the gcc man page. It is not clear what -O implys. Is -O equal to
> -O1 or -O2? If I wish to optimize making does it make sense to add
> CFLAGS=-O2 in the make.conf(5)?
-O is the same as -O1
Ah -- the shibboleth of cranking up the optimisation level to make
things run *really fast*. First of all, for general purpose code, -O
gets you most of the available optimisation benefits without causing
any problems. You can try CFLAGS=-O2 in /etc/make.conf if you like,
and most things will work OK but by no means all: some code will not
compile correctly under high optimization levels. The immediate
response if you report this sort of thing as a bug will be to see if
the problem is repeatable using a lower optimisation level.
Secondly, you will achieve a much greater performance improvement by
setting the CPUTYPE variable appropriately.
Cheers,
Matthew
--
Dr Matthew J Seaman MA, D.Phil. 26 The Paddocks
Savill Way
PGP: http://www.infracaninophile.co.uk/pgpkey Marlow
Tel: +44 1628 476614 Bucks., SL7 1TH UK
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 187 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-questions/attachments/20031104/86e32739/attachment.bin
More information about the freebsd-questions
mailing list