Date: Sat, 28 Apr 2001 13:14:14 +0200 From: Erik Trulsson <ertr1013@student.uu.se> To: stable@FreeBSD.ORG Subject: Re: Trouble with 4.3-RELEASE compiler Message-ID: <20010428131414.B5681@student.uu.se> In-Reply-To: <20010427180834.B24927@xor.obsecurity.org>; from kris@obsecurity.org on Fri, Apr 27, 2001 at 06:08:34PM -0700 References: <20010427155725.L18676@fw.wintelcom.net> <200104280035.UAA11427@ns1.rwwa.com> <20010427180834.B24927@xor.obsecurity.org>
next in thread | previous in thread | raw e-mail | index | archive | help
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. -- <Insert your favourite quote here.> Erik Trulsson ertr1013@student.uu.se To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-stable" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20010428131414.B5681>