Compiler optimization flags in building LFS-5.1.1

Ken Moffat ken at
Wed Sep 8 14:18:45 PDT 2004

On Wed, 8 Sep 2004, Roger Merchberger wrote:

> Here's a related question:
> When one uses the -Os switch, does it result in a smaller RAM profile (for
> the code, of course - I realize it won't affect data) or is the memory
> profile once loaded negligible?
> I want to put a new LFS on Flash, but am also wondering if it'll help my
> Spamassassin a bit as well... (having a [hopefully] smaller Perl
> interpreter...)

 If by "smaller RAM profile" you mean "does it use less memory when
running" then the answer is almost always yes.  Therefore, it
potentially gets more of the program into the cpu's cache.  But every
time there is a context switch the cache goes cold.  'size' will show
you how binaries are made up, and I suppose 'objump -d' will give you
the detail.

 I used to use -Os in just about everything to try to improve the
machine, but I never noticed any real difference between -O2, -Os, or
even -O3 -ffavourite-flags-here in normal running.  I did try some tests
on X-4.3 once, but the differences were pretty minor.  But, -Os in
gnumeric (and probably in other parts of gnome) on x86 is a bad idea, it
breaks things.

 If you've got a test machine, build both ways and run tests (obviously,
for SpamAssassin you need the same initial mailboxes, ham, spam files
each time as well as the same mail to categorise).  To put it on flash,
it's probably worth considering (although I still wouldn't use -Os in
the toolchain without a _lot_ of testing).  For a desktop build I
wouldn't bother any more, even on _old_ hardware.

 das eine Mal als Tragödie, das andere Mal als Farce

More information about the lfs-support mailing list