Subject: Re: Kernel optimizations!
To: David Laight <david@l8s.co.uk>
From: Sung N. Cho <sucho2@vt.edu>
List: netbsd-help
Date: 05/10/2002 08:22:05
Hi,

I'm getting the size of the kernel from the file manager "kfm" for the KDE.  
Just put the cursor over the generated kernel and kfm gives you the size of 
the kernel!

Sung N. Cho


On Friday 10 May 2002 09:26 am, David Laight wrote:
> On Thu, May 09, 2002 at 07:51:23PM +0000, Sung N. Cho wrote:
> > I was wondering, shouldn't turning on the optimization for gcc make the
> > kernel bigger?
>
> Probably not.  Most of the 'optimisations' that increase code size
> (eg loop unrolling and function inlining) are IMHO probably
> deoptimisations for modern hardware.  Indeed I don't think O3
> enables them.
>
> > I added in my /etc/mk.conf the following lines:
> >
> > COPTS+= -O3 -mcpu=i686 -march=i686
> > CXXFLAGS+= -O3 -mcpu=i686 -march=i686
> > CFLAGS+= -O3 -mcpu=i686 -march=i686
> >
> > Then compiled the kernel.  The prior size for the kernel which was
> > compiled with default -O2 option was 2.4M.  This new kernel with -O3
> > option turned on have now even smaller size, 1.8M!
>
> How are you measuring the size?
> You need to use 'size' not 'ls'!
>
> If you are seeing a 25% reduction it might be worth looking at
> some of the generated code.  Such a large change probably involves
> a major change in the way code has been compiled!
>
> 	David