[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-devel
Subject:    FYI: size optimizations
From:       Kurt Granroth <granroth () alpha ! tat ! physik ! uni-tuebingen ! de>
Date:       1999-05-22 21:56:50
[Download RAW message or body]

I was fooling around with different optimizations so that I could fit KDE on
my laptop (8M RAM, ~40M free disk space).  I didn't find *too* much that saved
on memory usage (that would take recoding quite a bit of stuff -- no magic
flags, I'm afraid).

HOWEVER, it *is* possible to reduce the size of the executable by quite a bit.

I used kbiff 2.3.6 (not yet released) as a benchmark.  I tried the following
flags:
  -fomit-frame-pointer
  -frepo
  -fno-rtti
  -fno-exceptions
  -O2
  -Os
  -mpentium
  -m386

I also tried the --enable-final trick in different combinations.

Conclusions
-----------
"Control" kbiff with no flags at all                 : 225,386K
-Os -fno-rtti -fno-exceptions -m386 (--enable-final) : 118,620K

-fomit-frame-pointer and -mpentium both INCREASE the size of the binary
(-fomit-frame-pointer by about 30%!!)

The following flags descreased the size of the pointer by the following
amount:

 -frepo          :  0.5%
 -fno-rtti       :  2.3%
 -m386           :  2.5%
 --enable-final :  5.2%
 -O2             : 14.6%
 -Os             : 17.5%
 -fno-exceptions : 31.3%

Some flags could not be used together (-O2 and -Os) and -frepo could not be
used with --enable-final.  I took the top flags and put them together to
produce a FINAL size savings of:

-Os -fno-rtti -fno-exceptions -m386 --enable-final: 47.3%

Not too shabby.

Keep in mind that the effect on the actual memory size while running doesn't
change all that much.  The VmExe field in kbiff went from 152K to 116K
(23.6%).. but none of the other fields changed at all.  Since VmExe is only
about 3% of the total size with KBiff, the overall size decrease in memory 
was barely noticable.

FINAL CONCLUSION:
Um.. I guess I don't have one.  If you are really concerned about hard drive
space, though, then it's *definitely* worth putting in the extra flags!
-- 
Kurt Granroth            | granroth@kde.org
KDE Developer/Evangelist | http://www.pobox.com/~kurt_granroth

        KDE -- Putting a Friendly Face on Linux

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic