Don't omit frame pointer (was Re: a.out binaries faster)

Marty Leisner (
Wed, 26 Feb 1997 11:21:09 PST

> Paul Gortmaker wrote:
> > [stuff about elf being slower than a.out deletec]
> > I'd say that the performance difference between the ELF and a.out versions
> > warrants an investigation of some sort. Comparing the "gcc -S" would be
> > a good start I guess...
> Yes, a.out is known to be generally faster than ELF, because
> ELF requires the use of an extra register. x86 processors being
> register-starved, I'm not surprised that you get the sort of result
> you quote. Generally the speed difference is negligible though (about
> 5%).
> You can usually get the speed back using the
> -fomit-frame-pointer
> optimization flag while compiling with GCC,
> (i.e: gcc -03 -fomit-frame-pointer ...). As the man page for GCC
> states, there is a caveat:

-fomit-frame-pointer is a terrible thing and is generally only
done much on linux becasue Linus decided to use it when
building the kernel (I'd say a good percentage of gcc users
who don't use Linux never used it...)

What this does it makes core dumps impossible to get meaningful
information from if you core dump in a library function (which is
possible even with debugged libraries which receive pointers to work
on (like free)).

Please don't -fomit-frame-pointer when building general use libraries.

Selecting better algorithms is a far better way to optimize code then
playing with compiler optimizations.