[ZPT] Speed of ZPT in Jython vs Cpython.
Alan Kennedy
zpt@xhaus.com
Mon, 4 Mar 2002 05:40:45 EST5EDT
Greetings,
I did manage to get some of ZPT working in Jython with a
couple of trivial changes. I realise now that a lot of code
in the current ZPT implementation is necessary for
integration with Zope. Understandable really :-)
So what I did was put a stopwatch on the compilation and
interpretation of the HTML TAL/tests/input/test01.html,
parsed using the HTMLParser, and evaluated using the
TALInterpreter.
The figures for Jython were a little disappointing. I tried
two different JVMs, and both of them were orders of
magnitude slower than CPython. The timings in milliseconds
are, as recorded on a 1.2Ghz Athlon,
Jython Jython
Cpython (JView) (JDK1.3.1)
---------------------------------------------------------
Compilation 50 270 350
Interpretation 10 95 190
I tried Microsoft's Jview because it is reputed to be the
fastest JVM around. And the figures do bear out that it is
comparatively faster than jdk1.3.1.
These sort of performance figures are a little worrying,
because it looks like evaulation of even a simple TAL page
will take a lot of CPU. So, for reasonably complex pages, I
could probably expect to turn out 2 - 3 pages a second on
machine with mid-range speed.
Hmm, it's not going to work that well in a web server
environment :-(
Are there any quick hits to speeding up ZPT in Jython?
Suggestions?
I did think of trying to write the whole thing in pure
Java. I'm not yet sure how much work this would be, and I'm
loath to commit to that until I know what I'm letting
myself in for.
But now that I know the structure of ZPT a little better,
it seems to me that I can have a reasonably complete XML
TAL engine by translating the following files:
TALParser.py
TALGenerator.py
TALInterpreter.py
XMLParser.py
DummyEngine.py
Also, it appears to me that DummyEngine is really not so
dummy, in that it evaluates the full range of Python
expressions. It's only when you get into path based
expression syntaxes, security models, etc, that something
more sophisticated is needed. Is that correct?
Cheers,
Alan.
---------------------------------------------
This message was sent using WebMail by CyberGate.
http://www.gate.net/webmail