Perl Vs Python

Isaac To kkto at csis.hku.hk
Sat Mar 8 07:24:59 EST 2003


>>>>> "kosh" == kosh  <kosh at aesaeion.com> writes:

    kosh> How slow it is compared to C/C++ is based on what you are doing
    kosh> with it. For somethings it is within 10-20% and sometimes less it
    kosh> just depends where your app is spending most of its time. 10-1000
    kosh> times slower although if yours is 100-1000 times slower then your
    kosh> program probably has an error as has been demonstrated on another
    kosh> thread here recently on speeding up an image app buy using
    kosh> different data structures.

The reason why somebody say it's 10% slower and some say it's 10000% slower
is since for somebody, the needed functionality is already provided by
Python, so the program boils down to "a few" Python operations ("a few" here
means something up to perhaps a million).  This might well be the "usual"
case, since the Python library is so extensive.  Then in fact most of the
things done is actually in C rather than Python.  In this case you are using
C to compete with C, actually.  In my case, Mandelbrot is not something
provided by C.  You need something like 200 operations to find the color of
every single pixel, all of them are simple floating point multiply and add.
I'll let you calculate the number of Python operations needed for a
1280x1024 screen.  Imagine you want this generation to be real time. =)

    kosh> For my own uses python is more then fast enough but my apps are
    kosh> also mostly io and network bound not cpu bound.

That's the point.  Nobody need it to be fast actually.

Regards,
Isaac.




More information about the Python-list mailing list