[Python-Dev] Re: Who cares about the performance of these opcodes?

Andrew MacIntyre andymac at bullseye.apana.org.au
Tue Mar 9 17:07:04 EST 2004


On Tue, 9 Mar 2004, A.M. Kuchling wrote:

> For a planned PyCon lightning talk, I'm benchmarking various combinations
> of optimizer options.
> One interesting result: CVS Python gets 25997 pystones on my machine when
> compiled with
> -O3 (the default), but 26707 when compiled with gcc's -Os flag.  -Os
> optimizes for size,
> running the subset of the -O2 optimizations that don't increase code size.

In my own experiments along these lines, I found that the best results
with various versions of gcc (2.8.1, 2.95.2, 3.2.1 on OS/2; 2.95.4, 3.2.3,
3.3.2 on FreeBSD) was to compile ceval.c with -Os (-O2 on 2.8.1, which
doesn't have -Os) and the rest of Python with -O3.

The OS/2 builds were running on an AMD Athlon 1.4GHz (Thunderbird core),
and the FreeBSD builds were running on an AMD Athlon XP 1600.  With the
compilers that support -march=athlon[-xp], another 4-5% can be had too.
The OS/2 builds also have -fomit-frame-pointer, which makes them
marginally faster than the FreeBSD builds of the same gcc version and
optimisation level.

I haven't seen your results (full -Os build as fast or faster than full
-O3 build), although compiling with -Os with gcc 3.2.x is as fast as -O3
with 2.95 and earlier.

Regards,
Andrew.

--
Andrew I MacIntyre                     "These thoughts are mine alone..."
E-mail: andymac at bullseye.apana.org.au  (pref) | Snail: PO Box 370
        andymac at pcug.org.au             (alt) |        Belconnen  ACT  2616
Web:    http://www.andymac.org/               |        Australia



More information about the Python-Dev mailing list