[MPlayer-dev-eng] Re: Compile options

Carl Eugen Hoyos cehoyos at ag.or.at
Sat Sep 16 14:59:30 CEST 2006


Guillaume POIRIER <poirierg <at> gmail.com> writes:

> On 9/15/06, Fredrik Smedberg <fredrik <at> cute.se> wrote:
> > What I don't get is why -O4? Isn't -O3 the highest optimize option gcc
> > have? I've also heard a lot of people give the advice to use -O2 because
> > -O3 many times generate slower code than -O2?
> 
> Well, it depends. 03 has a tendency of making codesize grow bigger
> because of aggressive inlining. This can be a very bad thing on big
> applications where it it won't pay off, but in the case of MPlayer,
> they _usually_ pay off. I'd suggest you test both O2 and O3 and check
> the speed of the resulting binary with -benchmark option over some
> sample files.
> 
> I'd be curious to see the results (compiler options and compiler
> version are a recurrent issue here, but usually ppl are too lazy to do
> appropriate benchmarking).

Here are my results and the appropriate patch:

Fantastic Four Trailer, 720p on Athlon XP 2600+ running SuSE10.0
gcc version 4.0.2 20050901 (prerelease) (SUSE Linux)
time mplayer fanta4_720p.mov -benchmark
(multiple tries, no lost frames, best results)

-O4:
BENCHMARKs: VC:  69.572s VO:   8.038s A:   2.032s Sys:  79.365s =  159.007s
BENCHMARK%: VC: 43.7541% VO:  5.0551% A:  1.2780% Sys: 49.9129% = 100.0000%

real    2m39.531s
user    1m12.721s
sys     0m0.652s

-O2:
BENCHMARKs: VC:  67.075s VO:   7.877s A:   1.984s Sys:  82.081s =  159.017s
BENCHMARK%: VC: 42.1811% VO:  4.9537% A:  1.2475% Sys: 51.6176% = 100.0000%

real    2m39.629s
user    1m9.408s
sys     0m0.680s

Regards, Carl Eugen

Index: configure
===================================================================
--- configure   (Revision 19851)
+++ configure   (Arbeitskopie)
@@ -1540,7 +1540,7 @@
   fi
   _stripbinaries=no
 elif test -z "$CFLAGS" ; then
-    CFLAGS="-O4 $_march $_mcpu $_pipe -ffast-math -fomit-frame-pointer"
+    CFLAGS="-O2 $_march $_mcpu $_pipe -ffast-math -fomit-frame-pointer"
 else
   _warn_CFLAGS=yes
 fi





More information about the MPlayer-dev-eng mailing list