Optimizationn questions?

Garrett Cooper youshi10 at u.washington.edu
Fri Mar 16 03:25:45 UTC 2007

Gary Kline wrote:
> On Wed, Mar 14, 2007 at 08:19:49PM -0700, youshi10 at u.washington.edu wrote:
>> On Thu, 15 Mar 2007, Danny Pansters wrote:
>>> On Thursday 15 March 2007 02:16, Gary Kline wrote:
>>>> 	Two quick one for kernel and/or compiler wizards:  first, is
>>>> 	a 400Mz processor considered a 586 (for my KERNELCONF file)?
>>> Think its 686 (but really, leaving 486 and 586 in isn't going to slow down
>>> booting or anything!) I always say: Use GENERIC unless you have a good 
>>> reason
>>> not to.
>>>> 	Second, is it safe to do a buildworld with -O3?  If there are
>>> No. It's not supported if things break.
>>>> 	stability concerns, I'll go with the default when I rebuild my
>>>> 	6.2 systems.
>>> The defaults should be fine. Also, like I said consider just using GENERIC 
>>> and
>>> load the odd kmod if needed. Generally it's less headache and equal
>>> performance.
>>>> 	thanks in advance,
>>>> 	gary
>>> Cheers,
>>> Dan
>> As Dan and Gary said -O3 isn't supported, and in many cases that "level of 
>> optimization" gets filtered out while compiling sections of FreeBSD.
>> Besides, I've compiled stuff with -O3 and various optimizations in Gentoo 
>> Linux before, and let me say that it caused a great deal of headaches... 
>> that's why I stick with -O2 now, because it's better to have something in 
>> executable shape and a bit slower (arguably because some optimizations slow 
>> things down) than it is to have something run fast and break all the time.
>> Some food for thought :).
> 	--Food for thought and a chuckle too!  (not to mention that
> 	it's waaay early, the chickens are still snoring, and I've
> 	only had *one* cup of joe)...   I've done some investigation
> 	with optimizing my own code, usually < 1000 lines, and haven't
> 	seen much gain between -O2 and -O3. Loop-unrolling may be
> 	different; one trick that compiler hackers at supercomputer 
> 	companies use by default in to unroll small loops.  Cray is
> 	one example.  Soooo, to get any real gain is going to mean
> 	going thru the most freq used tools (*grep, find, ls) and
> 	hand-tweak.  Might buy 5 - 7%.  
> 	have a good one,
> 	gary
>> -Garrett

No problem. -funroll-loops might not buy you too much other than a few 
less instructions overall but I'm not sure how intelligent gcc is at 
unrolling loops. It seemed like there was a difference between 
optimizations in the 4.x branch compared to the 3.4.x sub branch. They 
made a lot of improvements in the 4.x branch though.. it's just that 
some of those improvements broke code, so that's probably why FreeBSD 
doesn't have gcc-4.x in the base system.

Cheers :).

More information about the freebsd-questions mailing list