Python / C: small runtime difference?

Martin Schneider martin.schneider at
Tue Sep 9 11:06:01 CEST 2003


I want to extend Python with a C module, so to get the technology clear, I
wrote a Bubblesort over 10.000 elements in Python and in a C extension for
Python and got it running (YES! :-))


The Python Bubblesort runs 103 seconds, the C extension Bubblesort runs 28
seconds, this is about 1:4, which is far worse than I expected (assumed
about 100:1 or alike).

The interface overhead is neglectable (1/10 second).

Is this normal?

I am using Borland's free compiler BCC on Win32 and Python 1.5.2 (because
the customer uses other modules which do not run under newer versions).

Thank you for your ideas!


More information about the Python-list mailing list