PHP vs. Python (speed-wise comparison)

Jon Perez jbperez808 at wahoo.com
Mon Dec 27 13:54:13 EST 2004


stephen.mayer at gmail.com wrote:
> Anyone know which is faster?  I'm a PHP programmer but considering
> getting into Python ... did searches on Google but didn't turn much up
> on this.
> 
> Thanks!
> Stephen

If you're talking about usage as a server side scripting
language, then PHP will likely give better page serving
throughput for the same hardware configuration versus
even something that is mod_python based (but I believe
the speed diff would be well under 100%).

However, Python is just so much superior as a language (I
was deep into PHP before I tried out Python and I always hate
having to go back to PHP nowadays in the cases where it is
unavoidable) that you will still want to use Python even if
PHP requires lower server specs to handle the same throughput.

Also, if you have a more complex application for which
pooled variable reuse is an important performance-determining
factor, Python-based server-side scripting solutions might
offer better control of this aspect and may thus yield
superior performance to a PHP-based one.

The real problem with Python is not speed but _availability_.
The number of hosting services out there supporting mod_php
completely outstrips those supporting mod_python.  Moreover, they
are significantly cheaper, and offer a lot more features
(Fantastico, etc...).  The python-based hosting solutions
out there tend to be dedicated to Python and thus do not
offer these solutions.

If this is not an issue (i.e. you will be running your
own server), then I highly recommend going the Python
route using something like Spyce (which is the closest
thing to PHP in the Python world).



More information about the Python-list mailing list