Python Performance

Greg Ward gward at cnri.reston.va.us
Wed Jul 21 17:44:44 EDT 1999


sreekant kodela <sreekantk at freenet.co.uk> wrote:
> - Is there anyway I can improve the performance of python code.

It depends what the performance problem you're worried about is.  If
you're concerned about startup overhead of CGI scripts (and you should
be), then Python is certainly guilty, but a damn sight better than a
certain other popular scripting language widely used for CGI programming
(mainly because Python caches compiled bytecode files).  Apart from
PyApache, one possibility is Persistent CGI, which arose in Zope-land.
Andrew Kuchling recently wrote an Apache module (mod_pcgi.c) for this,
see ftp://starship.python.net/pub/crew/amk/new/.  Sounds like a good
idea, but I've never used it.

If you're concerned about runtime performance -- ie. how long it takes
to mangle strings and loop over lists and so forth -- I wouldn't worry
about it.  Yes, Python is slow, but the Internet is so much slower that
it hardly matters.

        Greg
-- 
Greg Ward <gward at cnri.reston.va.us>
Corporation for National Research Initiatives, Reston, VA, USA
http://starship.python.net/~gward/




More information about the Python-list mailing list