Speed Comparison Perl Python & C
Bart Nessux
bart_nessux at hotmail.com
Sun Feb 29 15:28:53 EST 2004
Dennis Lee Bieber wrote:
> On Sun, 29 Feb 2004 12:44:51 -0500, Bart Nessux
> <bart_nessux at hotmail.com> declaimed the following in comp.lang.python:
>
>> Just fooling around this weekend. Wrote and timed programs in C, Perl and
>> Python. Each Program counts to 1,000,000 and prints each number to the
>> console as it counts. I was a bit surprised. I'm not an expert C or Perl
>> programming expery, I'm most familiar with Python, but can use the others
>> as well.
>>
>> Here are my results:
>>
>> C = 23 seconds
>> Python = 26.5 seconds
>> Perl = 34.5 seconds
>>
> Given that the slowest part of those programs is the conversion
> from internal integer to printable format, followed by the actual I/O
> operation... and that, at the lowest level, Python uses the C I/O
> libraries, that isn't too surprising. All you've shown is the overhead
> on top of the C I/O system.
>
> You might want to read
>
> http://www.pythonsoft.com/empirical_data.pdf
>
> (Took me a while to find that -- the original author's site seems to
> have closed down)
>
> --
> > ============================================================== <
> > wlfraed at ix.netcom.com | Wulfraed Dennis Lee Bieber KD6MOG <
> > wulfraed at dm.net | Bestiaria Support Staff <
> > ============================================================== <
> > Home Page: <http://www.dm.net/~wulfraed/> <
> > Overflow Page: <http://wlfraed.home.netcom.com/> <
Thanks for the link, looks like a good read.
More information about the Python-list
mailing list