Profiling the Python Interpreter

Andrew MacIntyre andymac at bullseye.apana.org.au
Fri Oct 5 07:45:37 EDT 2001


On 4 Oct 2001 gb at cs.unc.edu wrote:

> I assumed something like this too. Believing doesn't make it true
> though. It turns out Cygwin is NOT the major problem. Running my
> program on identical hardware running Linux and the same version of
> Python+Numeric, runs about 25% slower than native Windows Python. The
> problem is evidently the quality of the code produced by gcc versus
> MSVC. There are numerous threads on various groups reporting
> comparable slowdowns between gcc and MSVC.

It is quite interesting comparing gcc versions and optimisation options,
which I have done for my port of Python to OS/2+EMX (equivalent to
Cygwin).

My findings with 2.1.1:-
gcc 2.8.1 with -O2 (no other optimisation options) was as good as I could
get, -O was the best option with gcc 2.95.2.  (didn't have 3.0.x)
I didn't try CPU specific options, other than -m486 (which reduced
performance on my K6/2-300), because I intended to distribute the
binaries.

Note also that some Python options (PYMALLOC in particular) can also be a
potential source of CPU cycle loss.

I note with interest that there are several notes in some of the docs
accompanying packages from netlib.org (lots'o'numerics code) that
recommend gcc 2.8.1 over later versions for numerics code.  This might be
out of date though.

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





More information about the Python-list mailing list