Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 4 Nov 2003 08:57:14 +0000
From:      Matthew Seaman <m.seaman@infracaninophile.co.uk>
To:        Zhang Weiwu <weiwuzhang@hotmail.com>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: optimize with -O2 or -O?
Message-ID:  <20031104085714.GC31448@happy-idiot-talk.infracaninophile.co.uk>
In-Reply-To: <3FA76159.6010807@hotmail.com>
References:  <3FA76159.6010807@hotmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help

--lCAWRPmW1mITcIfM
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Tue, Nov 04, 2003 at 04:20:41PM +0800, Zhang Weiwu wrote:
> Hello. I'm running 5.1-RELEASE.
>=20
> I read the gcc man page. It is not clear what -O implys. Is -O equal to=
=20
> -O1 or -O2? If I wish to optimize making does it make sense to add=20
> CFLAGS=3D-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=3D-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

--=20
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

--lCAWRPmW1mITcIfM
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.3 (FreeBSD)

iD8DBQE/p2nqdtESqEQa7a0RAhBdAJ99+gkfnIMGgpIHI+jhVeua2KprCwCZAZ9Y
GKXC2U2QFO+bykq5iaLtQbQ=
=GSDE
-----END PGP SIGNATURE-----

--lCAWRPmW1mITcIfM--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20031104085714.GC31448>