From owner-freebsd-stable Sat Apr 28 4:14:21 2001 Delivered-To: freebsd-stable@freebsd.org Received: from mailg.telia.com (mailg.telia.com [194.22.194.26]) by hub.freebsd.org (Postfix) with ESMTP id 58AB137B424 for ; Sat, 28 Apr 2001 04:14:15 -0700 (PDT) (envelope-from ertr1013@student.uu.se) Received: from d1o913.telia.com (d1o913.telia.com [195.252.44.241]) by mailg.telia.com (8.11.2/8.11.0) with ESMTP id f3SBEEF12429 for ; Sat, 28 Apr 2001 13:14:14 +0200 (CEST) Received: from ertr1013.student.uu.se (h185n2fls20o913.telia.com [212.181.163.185]) by d1o913.telia.com (8.8.8/8.8.8) with SMTP id NAA17194 for ; Sat, 28 Apr 2001 13:14:10 +0200 (CEST) Received: (qmail 5719 invoked by uid 1001); 28 Apr 2001 11:14:15 -0000 Date: Sat, 28 Apr 2001 13:14:14 +0200 From: Erik Trulsson To: stable@FreeBSD.ORG Subject: Re: Trouble with 4.3-RELEASE compiler Message-ID: <20010428131414.B5681@student.uu.se> Mail-Followup-To: stable@FreeBSD.ORG References: <20010427155725.L18676@fw.wintelcom.net> <200104280035.UAA11427@ns1.rwwa.com> <20010427180834.B24927@xor.obsecurity.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: <20010427180834.B24927@xor.obsecurity.org>; from kris@obsecurity.org on Fri, Apr 27, 2001 at 06:08:34PM -0700 Sender: owner-freebsd-stable@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG On Fri, Apr 27, 2001 at 06:08:34PM -0700, Kris Kennaway wrote: > On Fri, Apr 27, 2001 at 08:38:30PM -0400, User Witr wrote: > > > > bright@wintelcom.net said: > > :-As far as I know FreeBSD doesn't support nor recommened compiling > > :-things (especially large mission critical programs) with anything > > :-higher than -O. > > > > Out of curiosity, how much potential performance is FreeBSD throwing > > away by banning -O2 and -O3? To my naive eyes it would seem better > > to light that candle (try fix the -O2 bug) than curse the darkness. > > Assuming there is significant performance gain and there truly is only > > one major -O2 bug. -O2 used to be considered "safe" didn't it? > > It's not that significant in many cases, it's mostly just useful to > make you feel studly about how massively optimized your system must > be. > > Kris Also, compiling with -O3 can sometimes actually make your code *slower*. This is probably due to the fact that -O3 causes inlining to take place which can easily make the code larger which in turn make the code not fit in the CPU-cache any longer. Generally I would say that one shouldn't use -O3 unless some measurements have been made and -O3 can be shown to actually have a positive effect on the code in question. Compiling with -O2 is usually not worth the bother unless your program is fairly CPU-intensive. Many programs (like text-editors or the kernel) spend most of their time waiting for I/O. In these cases the improvements that -O2 might create are barely measurable. The best way is usually to try to compile a program with different optimization levels and try to measure what difference it makes. For some programs -O2 can cause much better performance than -O. For others the difference is very small and for some -O2 might even generate worse code than -O. The difference between -O and no optimization is usually significant though if only because the code generated by gcc without any optimization being done is fairly inefficient. -- Erik Trulsson ertr1013@student.uu.se To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-stable" in the body of the message