Switch from perl to python?
Roy Smith
roy at panix.com
Sat Dec 14 09:31:07 EST 2002
Pekka Niiranen <krissepu at vip.fi> wrote:
> I have done several projects with Python myself and
> in each eventually faced the same limitation:
> In order to get the performance, C -extensions were needed.
There is no doubt that well-written C or C++ can be a lot faster than
well-written Python. But, the same is true of all interpreted languages
(Perl, TCL, shells, etc). Here's why that should not be a big issue:
1) For many applications, it just doesn't matter how fast the program
is. There is a huge class of everyday tools that people write which run
fast that there's not incentive to make them faster. Application
development/debug time is much more important than run time.
2) For those applications where speed is an issue, you will usually find
that the 90/10 rule applies -- 90% of the time is spent executing 10% of
the code. Python makes it fairly simple to write extension modules in C
Somebody who is skilled at both languages should be able to sit down
with the embedding/extending documentation and have working code by the
end of the day. The efficient thing to do is to write the whole thing
in Python, profile your application to see which couple of routines eat
up all the time, then selectively recode those in C if you feel the
performance gain will be worth the effort.
More information about the Python-list
mailing list