Speed Comparison Perl Python & C

Bart Nessux bart_nessux at hotmail.com
Sun Feb 29 15:27:56 EST 2004


Ville Vainio wrote:

>>>>>> "Bart" == Bart Nessux <bart_nessux at hotmail.com> writes:
> 
>     Bart> fair test. I thought C would do this much faster than it
>     Bart> did. Any ideas?
> 
> Your program prints stuff at every iteration, so it mostly measures I/O
> performance. Drop out the print, or print every 1000th item, and you
> will start seeing a significant differences...
> 
> This is also a textbook example of a case where using C doesn't make
> much sense performace-wise. Many seem to believe that using C/C++ also
> magically speeds up I/O, and choose it over alternatives because their
> network server "needs to be fast".
> 

I would be one of the many that you refer to. I've listened to too many
people talk about the speed of C compared to python or other interpreted
languages. Obviously, these people talked of this speed difference to be a
generality (anything done is C is *much* faster than anything equivalent in
Python). My test doesn't support that. It is faster, but not significantly.

I think C is *significantly* faster when it's being used by someone who
*knows* what they're doing and more importantly, they understand *why* C is
faster for the task. That's something that I currently lack... that
understanding. That's why I experiment with the two and post to this group.

Thanks,
Bart



More information about the Python-list mailing list