[BusyBox] Why is it so bad...?

Alex Holden alex at linuxhacker.org
Mon Jan 22 20:30:47 UTC 2001


On Mon, 22 Jan 2001, Tom Cameron wrote:
> 	I was reading through the GCC man page, wondering what horrible
> things '-O3' did to code, so as to make most people shy away from it.  I

I don't think it does anything "bad"- the main thing it does is
automatically inlining functions. On some less mature architectures,
optimisation in general (not necessarily the features that -O3 turns on
specifically) can be buggy, and you may occasionally find the compiler
freezing or crashing on certain constructs when optimisation is turned on 
(so you need to build the file by hand with optimisation off instead).
I doubt you'll encounter this on x86, and it's starting to get fairly 
rare on architectures like ARM. I found in developing TEA-Total that
certain code ended up much bigger with -O3 than with -O2 without a
significant speed increase. -Os on the other hand slowed things down
without giving much of a size decrease, so I'm using -O2. This is on x86
Linux with GCC 2.95.2.

> have compiled kernels and programs with this option (instead of -Os or -O2),

As I understand it the reason the kernel uses -O2 is because the critical
paths have already been hand optimised so much that running it through
a machine optimiser which doesn't know anything about the context could
actually make things worse (for example, by increasing the code size and
thus increasing the cache miss frequency).

-- 
------- Alex Holden -------
http://www.linuxhacker.org/
 http://www.robogeeks.org/







More information about the busybox mailing list