[mythtv] Compiling with -Os is better than -O3

John P Poet jppoet at gmail.com
Sun Jan 29 23:01:24 UTC 2006


On 1/17/06, Daniel Kristjansson <danielk at cuymedia.net> wrote:
> On Mon, 2006-01-16 at 20:55 -0700, John P Poet wrote:
> > Is there an easy way to configure Myth such that it builds with -Os
> > instead of -O3?  I have been editing the configure script before
> > running it, but was wondering if there is a better way.
>
> > My frontend machine has a Intel Northwood 3.2GHz HT P4 and 512MB of
> > RAM.  With this configuration, I have found that compiling myth with
> > -Os is better than -O3.
>
> Have you changed your compiler?
>
> The Northwood has a 512KB L2 cache, which should be sufficient for
> -O2/-O3 to be faster than -Os. Generally the script is supposed to use
> -Os for processors with 256 KB or smaller L2/L3 cache and -O2/-O3 for
> ones with a 512KB or larger cache. The benchmarking I did for that
> decision was with gcc 3.x. P4 based cores don't really need some
> of the -O2/-O3 optimizations, like aligning jump targets, but some
> of the newer processors like the Pentium-M and the Athlon chips do
> benefit from the alignment; but they didn't seem to hurt with gcc 3.x.
>
> gcc 4+ does some additional optimization at -O2 and -O3 which may be
> hurting you as far as cache performance is concerned. You might want
> to try disabling the new optimizations in -02...
>  See http://gcc.gnu.org/onlinedocs/gcc-4.0.2/gcc/Optimize-Options.html
>  And http://gcc.gnu.org/onlinedocs/gcc-3.3/gcc/Optimize-Options.html
>
> -- Daniel

Finally had some time to play with this.  You are correct, I am using
gcc-4.  With gcc-4, -O2 produces better code for the frontend, than
-O3 does.  With -O2, playback at high bitrates and higher than 1.0x
speeds is smoother than with -O3.

John


More information about the mythtv-dev mailing list