[Petal] Modifiers and variables

Fergal Daly fergal at esatclear.ie
Thu Aug 19 13:58:11 BST 2004


On Thu, Aug 19, 2004 at 01:30:08PM +0100, Steve Purkis wrote:
> Compiled templates make a lot of sense, I wouldn't discount this option.

There's a large speedup to be had here, when I did it last year it was
something like a factor of 4 for a template I had made for a web based
dictionary. Can't really remember how much though. I do know that the
difference was much more significant if you were allowed to use

this{that}[17]

rather than

this/that/17

as the latter still has to do a lot of thinking at runtime whether it's been
compiled or not

The other problem is that you cannot compile

mod:this/that/theother

at all because you have no way of knowing what this/that/theother means. You
could compile it if it was one of the parsed_process() modifiers discussed
earlier.

> >and parse it like
> [snip]
> >One problem with the above is that the "then" expression gets 
> >evealuated
> >even if the "if" expression is false, this is unavoidable because Petal
> >currently cannot parse without also evaluating,
> 
> Ah, that might mean some performance hits.  Even unexpected behaviour 
> (if objects change state in the background).

Exactly.

> Maybe some rethinking Petal's parsing engine is in order?

The "problem" is that parsing and evaluation happen at the same time.
Separating them into different stages would be less efficient and so is
probably only worth doing if you're going go for the full monty and parse
compile your expressions into the template,

F


More information about the Petal mailing list