Optimizing TAL (Was: Re: [Zope] Passing arguments to a ZPT)

Johan Carlsson [EasyPublisher] johanc@easypublisher.com
Sun, 23 Mar 2003 18:52:33 +0000


At 13:10 2003-03-23 +0000, Johan Carlsson [EasyPublisher] said:
>At 22:22 2003-03-22 +0100, Max M said:
>>Johan Carlsson [EasyPublisher] wrote:

Regarding my concern for speed of TAL/ZPT.
I read a from evansimpson (on 
http://www.zope.org/Members/peterbe/ZPTstyleguide):

"""\
Page Templates will certainly come close to DTML in speed. The only
advice I can give with respect to speed is to make a local variable for
any path that you use several times ...
evensimpson - 2001-06-22
"""

As I understand it paths are used all the time in TAL.
For instance in DTML I usually push an object on the current namespace
to fill in messages:

<dtml-with Custom>
<tr><th><dtml-var header1></td><td<dtml-var content1</td></tr>
<tr><th><dtml-var header2></td><td<dtml-var content2</td></tr>
<tr><th><dtml-var header3></td><td<dtml-var content3</td></tr>
</dtml-with>

Converting this to TAL I get something like:

<tr><th tal:content="Custom/header1"></td><td 
tal:content="Custom/content1"></td></tr>
<tr><th tal:content="Custom/header2"></td><td 
tal:content="Custom/content2"></td></tr>
<tr><th tal:content="Custom/header3"></td><td 
tal:content="Custom/content3"></td></tr>

I get the feeling that this will be come less effective that the DTML version?
The time spent should increase with the number of paths needed to evaluate?

Could this be optimized some how? Or could it be written in a more 
efficient way?
Or is it even possible to use something similar to dtml-with?

Best Regards,
Johan Carlsson




-- 
Easy Publisher Developers Team
Johan Carlsson
johanc@easypublisher.com

Mail:
Birkagatan 9
SE-113 36  Stockholm
Sweden

Phone +46-(0)8-32 31 23
Fax +46-(0)8-32 31 83
Mobil +46-(0)70-558 25 24
http://www.easypublisher.com