Webware vs. PHP - performance comparision!!!
kosh
kosh at aesaeion.com
Mon Oct 6 01:02:43 EDT 2003
On Sunday 05 October 2003 18:46, JZ wrote:
> My hardware and software settings are:
>
> WindowsXP Pro, Athlon XP2800+, 512DDRdual,
>
> Python 3.3.2 stable
> Webware & WebKit & mod_webkit.dll CVS 2003-09-19
> Cheetah CVS 2003-09-19
> Spyce 3.11
> vs.
> PHP 4.3.3 stable
> MMCache 2.4.1
>
> For page request I used wget.
>
> 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
>
> testpython.py:
> ===========
> from WebKit.Page import Page
> class testpython(Page):
> def writeHTML(self):
> cpunter = 100
> i=int(self.request().field('c', 0))
> self.write('<p>Try: %d</p>' % i)
> if 0 < i <100:
> i += 1
> self.write("<a href='http://%s?c=%d'>next</a>" %\
> (self.request().serverURL(), i))
> else:
> self.write("<a href='http://%s?c=1'>next</a>" %\
> self.request().serverURL())
Okay I modified this code to this:
cpunter = 100
i=int(context.REQUEST.form.get('c', 0))
print '<p>Try: %d</p>' % i
if 0 < i <100:
i += 1
print "<a href='%s?c=%d'>next</a>" % (context.REQUEST.URL, i)
else:
print "<a href='%s?c=1'>next</a>" % context.REQUEST.URL
return printed
Which I used in a zope python script and modified your test script to just use
only the one url I have. I tested it on an athlon xp 2000 with 1G of ram
under linux with zope 2.6.2 running python 2.2.3 and I got
time: 0.679494 s
That places it at about 5.8x faster then your php mcache version on a slower
cpu and with no caching.
I have also profiled zope before doing very simple pages like this and it
seems to spend about 95% of it time in security checks which make almost no
impact on the speed of a real page. I find it very hard to believe that I
have slower ram, a slower cpu and am running zope and manage to beat all of
your tests by such an extreme margin.
Overall considering all the security checks that zope makes just about
anything should be faster that is not performing security checks. I suspect
your setup is flawed somewhere or that windows xp as got to be the most
aweful os to do web stuff on ever to have seen the light of day which I admit
is certainly possible and even likely. :)
You should look at your test results again and how you ran the test since
there is probably a major flaw somewhere. Also the zope solution I have shown
is certainly not optimized and I could make it faster. Python is not the slow
part in this test.
More information about the Python-list
mailing list