From owner-freebsd-questions@FreeBSD.ORG Tue Nov 4 00:57:39 2003 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id DA5A716A4CE for ; Tue, 4 Nov 2003 00:57:39 -0800 (PST) Received: from smtp.infracaninophile.co.uk (smtp.infracaninophile.co.uk [81.2.69.218]) by mx1.FreeBSD.org (Postfix) with ESMTP id 4867B43FA3 for ; Tue, 4 Nov 2003 00:57:38 -0800 (PST) (envelope-from m.seaman@infracaninophile.co.uk) Received: from happy-idiot-talk.infracaninophile.co.uk (localhost [127.0.0.1]) hA48vEdl032052 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 4 Nov 2003 08:57:34 GMT (envelope-from matthew@happy-idiot-talk.infracaninophile.co.uk) Received: (from matthew@localhost)id hA48vEbu032051; Tue, 4 Nov 2003 08:57:14 GMT (envelope-from matthew) Date: Tue, 4 Nov 2003 08:57:14 +0000 From: Matthew Seaman To: Zhang Weiwu Message-ID: <20031104085714.GC31448@happy-idiot-talk.infracaninophile.co.uk> Mail-Followup-To: Matthew Seaman , Zhang Weiwu , freebsd-questions@freebsd.org References: <3FA76159.6010807@hotmail.com> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="lCAWRPmW1mITcIfM" Content-Disposition: inline In-Reply-To: <3FA76159.6010807@hotmail.com> User-Agent: Mutt/1.5.4i X-Spam-Status: No, hits=-4.8 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=2.60 X-Spam-Checker-Version: SpamAssassin 2.60 (1.212-2003-09-23-exp) on happy-idiot-talk.infracaninophile.co.uk cc: freebsd-questions@freebsd.org Subject: Re: optimize with -O2 or -O? X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 Nov 2003 08:57:40 -0000 --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--