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

Daniel Kristjansson danielk at cuymedia.net
Tue Jan 17 18:13:11 UTC 2006

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

More information about the mythtv-dev mailing list