Compiler optimization flags in building LFS-5.1.1

Roger Merchberger zmerch at
Wed Sep 8 15:15:12 PDT 2004

Rumor has it that Ken Moffat may have mentioned these words:

>  If by "smaller RAM profile" you mean "does it use less memory when
>running" then the answer is almost always yes....

Kewl. ;-)

>  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 can't say on "normal running" but I found that -Os was a little bigger 
than -O2 on "hello world" -- until I stripped the symbols, then it was a 
little smaller than -O2. This is *not* what I'd call a "real world" 
example... ;-)

I've seen -O3 make a few things run a *lot* faster, but I've also seen it 
b0rk a lot of stuff, too -- My first LFS (4.0) was almost all -O3 with 
other things for my Crusoe processor, and my ncurses acts "oddly" as do 
several other things. It's *stable*, but it's "odd." ;-)

>   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.

There'll be no X on this machine, so... ;-)

>  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...

As spamassassin has such a large memory print, and can have several copies 
running at once, even a very minor improvement can mean the difference 
between getting bogged in swap or not... (My SA memory profile is around 30M!)

>  (although I still wouldn't use -Os in
>the toolchain without a _lot_ of testing).

Handy info! Thanks!

Ah well -- more things to test... ;-)
Roger "Merch" Merchberger

Roger "Merch" Merchberger   | A new truth in advertising slogan
sysadmin, Iceberg Computers | for MicroSoft: "We're not the oxy...
zmerch at          |                oxymoron!"

More information about the lfs-support mailing list