I created an application based on Webware and Python. I was surprised why it works so slowly. So I decided to check how fast are different Python solutions against PHP.
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()) testcheetah.tmpl: ============= #set $counter = 100 #set $i=$int($request.field('c', 0)) <p>Try: $i</p> #if 0 < $i <$counter: <a href='http://${request.serverURL()}?c=${i+1}'>next</a> #else <a href='http://${request.serverURL()}?c=1'>next</a> #end if testpsp.psp: ========== <% counter = 100 i=int(req.field('c', 0)) res.write("<p>Try: %d</p>" % i) if 0 < i <counter: res.write("<a href='http://%s?c=%d'>next</a>" % (req.serverURL(), i+1)) else: res.write("<a href='http://%s?c=1'>next</a>" % req.serverURL()) %> testspyce.spy ========== <%\ counter = 100 i =request.get1('c', 0) %> <p>Try: <%=i%></p> <%if 0 < i < counter:{%> <%i += 1%> <a href='http://localhost<%=request.uri("path")%>?c=<%=i%>'>next</a> <%} else: {%> <a href='http://localhost<%=request.uri("path")%>?c=1'>next</a> <%}%> testphp.php: ========== <?php $counter = 100; $i =$_GET['c'] ? $_GET['c'] : 0; echo "<p>Try: $i</p>"; if ($i > 0 and $i < $counter) { $i += 1; echo "<a href='http://{$_SERVER['SERVER_NAME']}{$_SERVER['PHP_SELF']}?c=$i'>next</a>"; } else { echo "<a href='http://{$_SERVER['SERVER_NAME']}{$_SERVER['PHP_SELF']}?c=1'>next</a>"; } ?> RESULTS: ========= Webware servlet without templates: >>>http://localhost/WK/test/test1/testpython.py => time: 20.078000 s Webware servlet with its PSP templates >>>http://localhost/WK/test/test1/testpsp.psp => time: 20.015000 s Webware with Cheetah template/servlet: >>>http://localhost/WK/test/test1/testcheetah.tmpl => time: 20.235000 s Webware with Cheetah servlet (compiled with cheetah-compile script): >>>http://localhost/WK/test/test1/testcheetah.py => time: 20.250000 s PHP with mod_php4 and MMCache free accelerator >>>http://localhost/testphp.php => time: 3.891000 s [mcache & mod_php4] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ PHP as CGI >>>http://localhost/testphp.php => time: 15.094000 s Spyce as CGI: >>>http://localhost/testspyce.spy => time: 53.672000 s (I coud not test Spyce and mod_python because mod_python 3.0.3 does not work with Python 2.3.2) What you think about it? PHP with MMCache accelerator is about 6x faster than teh fastest Python! I like Python but I am very disappointed its performance!!! :-((((( The difference is so huge, that I think about rewriting my Python code back to PHP.... Links: Python http://www.python.org/ Webware http://webware.sourceforge.net/ Cheetah http://www.cheetahtemplate.org/ Spyce http://spyce.sourceforge.net/ PHP http://www.php.net/ MMCache http://turck-mmcache.sourceforge.net/ -- JZ ICQ:6712522 ------------------------------------------------------- This sf.net email is sponsored by:ThinkGeek Welcome to geek heaven. http://thinkgeek.com/sf _______________________________________________ Webware-discuss mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/webware-discuss