Webware vs. PHP - performance comparision!!!

Ian Bicking ianb at colorstudy.com
Mon Oct 6 04:39:19 EDT 2003


On Sun, 2003-10-05 at 19:46, JZ wrote:
> My testing code is
> =============
> import os, time
> url = [
>     r'http://localhost/WK/test/test1/testpython.py',
>     r'http://localhost/WK/test/test1/testcheetah.tmpl',
>     r'http://localhost/WK/test/test1/testcheetah.py',
>     r'http://localhost/WK/test/test1/testpsp.psp',
>     r'http://localhost/testphp.php',
>     r'http://localhost/testspyce.spy',
>     ]
> for u in url:
>     t1=time.time()
>     print '>>>%s' % u,
>     os.system('wget  -m %s -o stress.log' % u)
>     t = time.time()-t1
>     print ' => time: %f s' % t

I don't think this testing code is reliable.  When I use ab
(ApacheBench, comes with the Apache distribution) I get something like
130 requests/sec for the Python servlet, and 250 requests/sec for the
PHP script (though without MMCache).  My system doesn't match yours --
I'm working off a slightly different version of Webware, on Linux
instead of Windows, and maybe other differences as well.  But it's
pretty far off from your results.

To do the tests I run "ab -n 1000 http://localhost/whatever"

To test *Python's* speed vs. PHP, you'd have to use mod_python -- it's
the only Python *environment* that is equivalent to PHP (well, PHP as
CGI is like Python as CGI, but that's not a realistic test -- if you
care about raw performance neither option is good).  That's if you are
wondering about the raw speed of the language.  But I'm confident that
Python would do quite well in that test for any non-trivial application.

If you want to test the framework's speed, well, just be sure to use the
right tools, and take results from trivial applications with some salt. 
Persistent Python applications can be optimized in a lot of ways -- many
of those optimizations are language-neutral (caching database output,
avoiding network connections, calculating dependencies, etc), but are
easier to implement in Python than PHP.

  Ian







More information about the Python-list mailing list