From owner-freebsd-current Sat Feb 8 16: 9:54 2003 Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 0287337B401 for ; Sat, 8 Feb 2003 16:09:53 -0800 (PST) Received: from stork.mail.pas.earthlink.net (stork.mail.pas.earthlink.net [207.217.120.188]) by mx1.FreeBSD.org (Postfix) with ESMTP id 7AEF943F3F for ; Sat, 8 Feb 2003 16:09:52 -0800 (PST) (envelope-from tlambert2@mindspring.com) Received: from pool0373.cvx40-bradley.dialup.earthlink.net ([216.244.43.118] helo=mindspring.com) by stork.mail.pas.earthlink.net with asmtp (SSLv3:RC4-MD5:128) (Exim 3.33 #1) id 18hf2X-0003vf-00; Sat, 08 Feb 2003 16:09:46 -0800 Message-ID: <3E459BF3.BB3FC381@mindspring.com> Date: Sat, 08 Feb 2003 16:08:19 -0800 From: Terry Lambert X-Mailer: Mozilla 4.79 [en] (Win98; U) X-Accept-Language: en MIME-Version: 1.0 To: David Schultz Cc: Ray Kohler , freebsd-current@FreeBSD.ORG Subject: Re: Compiling with high optimization? References: <20030208173756.GA56030@arkadia.nv.cox.net> <20030208232724.GA20435@HAL9000.homeunix.com> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-ELNK-Trace: b1a02af9316fbb217a47c185c03b154d40683398e744b8a48a9934feaaac47a186b7891fa2248f782601a10902912494350badd9bab72f9c350badd9bab72f9c Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG David Schultz wrote: > Thus spake Ray Kohler : > > Has anyone tried building world/kernel with high optimizations (-O2, > > -O3) recently? What breaks? (Booby prize to whoever says "common sense" > > ;) I last tried it quite a few months ago and the resolver died on me, > > don't know what else. I'm not really thinking of running like that, but > > I am curious about others' experiences. > > First, let me answer the question that you really meant to ask but > forgot to, namely, ``How much of a performance difference does -O3 > make over -O for the kernel/world?'' The answer is ``very little, > for most purposes.'' So if you do use higher optimization levels, > at least do a little benchmarking to make sure it was worth it. Actually, failure to use optimization suppresses some compilation warnings, particularly those which normally print from using some variables without initializing them. We were just bit by this, the other day (search -current list archives for "zebras": mea maxima culpa). > To answer your second question, higher optimization levels usually > work, but there *will* be new bugs. I know of several libc > problems due to -fstrict-aliasing, and I'm told that the inline > assembly for TCP checksumming can still break. There are a number of places, particularly on non-i386 platforms, where optimization actually doesn't work. I think that's why it was turned off for the libc compilation, and why the bug crept in. It's probably useful to compile world with optimization occasionally, to make compilation-time detectable bugs like that to show up, but, as you point out, it'd probably be a *bad* idea to actually use the resulting code, at least until after the next GCC import, which will supposedly fix the Alpha optimizer. -- Terry To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message