On Thu, 09 Jan 2003 21:35:12 EST, Michael Jennings <[EMAIL PROTECTED]> said:
> -O9 is ridiculous. Nothing over -O3 actually means anything, and even
> -O3 tends to be a bad idea. He referred to -O3 as "turning on all the
optimizations that probably shouldn't even be part of the optimizer."
>
> It's also worth noting that omitting the frame pointer does give you a
> boost but makes debugging essentially impossible, at least with gdb.
This topic got beaten to death on the linux-kernel list a while ago. Apparently
there's some non-intuitive results here:
1) -Os seems to produce better code than either -O2 or -O3 on some CPUs. On
many boxes, especially those with pathetically small L1 instruction caches or
prefetch buffers, loop unrolling is actually a Bad Thing in many cases. (This
effect has been known about ever since the PDP-10, where the low 16 memory
addresses were actually registers - so if you had a tight loop that used 3
registers as variables, getting the code to fit in 13 words and copying it
to low memory before execution was a HUGE win).
2) omit-frame-pointer can cause increases in both code size and execution
speed - there's apparently a trade-off between the number of cycles and code
bytes spend doing frame pointer setup, and the cycles/bytes spent doing
stack references. Apparently, if you make more than 5-6 'mov' references
to the stack, you're better off *with* a frame pointer - which is why
omit-leaf-frame-pointer exists, so non-terminal functions that will beat on
the stack will have one, but all those little 3-4 line functions that don't
hit the stack much won't...
--
Valdis Kletnieks
Computer Systems Senior Engineer
Virginia Tech
msg00028/pgp00000.pgp
Description: PGP signature
