On Thu, 2006-02-16 at 22:14 +0100, Daniel McBrearty wrote:
> One question about the various template systems and mod_perl : is
> there not a performance hit in using these?

As opposed to not using anything?  Yes.  They are much faster than what
people usually write on their own though.

>  If there is effectively perl code in the template which actually
> changes with different pages that load, isn't mod_perl forced to
> recompile the code for each request? 

There are different pages for different templates, but once they have
been compiled they don't need to be loaded again.  See my templating
article for more on how this works.

> When I looked at all this a while back, I figured that this must be
> the case, and went with CGI::FastTemplate as it uses pure regex
> matching, I suspected it was likely to avoid this. Was I wrong? Is my
> code actually quicker than it would have been with TT / Mason? 

Probably slower.  TT and Mason don't need to do any regexes because they
have compiled the template to a perl sub.  They don't have to parse the
template at all after the first request in each process.  Of course they
have their own sources of overhead, but template parsing is not one of
them.

- Perrin

Reply via email to