[Python-Dev] Python & GCC 3.0

Tim Peters tim@digicool.com
Tue, 19 Jun 2001 15:14:10 -0400


[Fred L. Drake, Jr.]
> GCC 2.95.3:
> This machine benchmarks at 6329.11 pystones/second
> ...
> GCC 3.0:
> This machine benchmarks at 6060.61 pystones/second
> ...
> This is one a Linux-Mandrake 7.2 installation with non-cooker updates
> installed, and still using the Linux 2.2 kernel:
>
> cj42289-a(.../python/linux-gcc-3.0); uname -a
> Linux cj42289-a.reston1.va.home.com 2.2.17-21mdk #1 Thu Oct 5
> 13:16:08 CEST 2000 i686 unknown

This is a good place to note that the single biggest "easy win" for pystone
is to run it with -O (that is, Python's -O).  Yields a 10% boost on Fred's
box, and about 7% on MSVC6+Win2K.

pystone is more sensitive to -O than most "real Python apps", probably
because it's masses of very simple operations on scalar types -- no real
classes, no dicts, no lists except to simulate fixed-size C arrays, lots of
globals, and so on.  The dynamic frequency of SET_LINENO is high, and the
avg work per other opcode is low.

OTOH, that's typical of *some* Python apps, and typical of *parts* of almost
all Python apps.  So it would be worth getting ridding of SET_LINENO even in
non- -O runs.  Note that SET_LINENO isn't needed to get correct line numbers
in tracebacks (and hasn't been needed for years), it's "just" there to
support tracing now.  Vladimir had what looked to be a workable scheme for
doing that a different way, and that would be a cool project for someone to
revive (IMO -- Guido's may differ, but he's too busy to notice what we're
doing <wink>).