PHPTAL compiles its templates into native PHP code so the runtime overhead
is very low. I don't know much about WP's native templating engine but I
think to recall it was just some hooks (php functions) being called by the
core. In this case PHPTAL would be a tad slower but not enough to worry
about for the average WP based site.
Regarding expressions to avoid, tales expressions translate quite directly
to equivalent PHP code, so it doesn't matter how complicated the expression
is, it'll be as fast as equivalent native PHP code written by an average
One thing to care a bit about is the use of modifiers like the translation
or the cache ones, they add some aditional logic to the runtime execution,
usually meaning disk access, so they should be used with caution and only
Running more than one instance of PHPTAL for diferent sections will affect a
little bit the overall performance, if the WP templating system allows it,
check out the "metal" namespace to get two-step/slot functionality.
As for the PHPTAL code itself, it could be further improved by eliminating
the need to check if a template has been already compiled or not, useful
when all templates are already compiled and no longer changed.
Besides all that, if someone bugs you about a compiling template engine
(such as PHPTAL itself) performance, ask first if they are using an opcode
cache like APC, XCache or Zend Optimizer :)
On Sun, Jan 4, 2009 at 1:05 AM, Alister Cameron <
> Hi again.
> After an aborted attempt about a year ago, I am now making great headway on
> a PHPTAL WordPress theme. This has been a bit of a "holy grail" project for
> me, and as someone with limited experience with PHP, a big challenge.
> Good news is I am getting through it and have overcome all the obstacles so
> I know that one of the questions I will be asked from the WordPress
> community is about how big a "performance hit" PHPTAL will impose. To that,
> I would like to be able to reply with some wisdom from PHPTAL experts :)
> Can you please shed some light on what are "best practices" regarding
> keeping PHPTAL "fast"?
> For example, are there certain PHP expressions to avoid? Is there some
> acknowledged ugly "syntax" that should be avoided? Should only on e template
> object be used or does using multiple template objects for page components
> make no real difference to overall performance?
> These are the sorts of performance questions I have and am wondering if
> there is any "agreed best practice" out there...?
> Many thanks!
> PS. If there is anyone here with both a) WordPress experience and b) PHPTAL
> expertise who would like to have a look at my theme -- especially to help me
> refine and improve it -- I would love to hear from you.
> Alister R Cameron
> CEO // Australis Media Pty Ltd
> Mob. 04 0404 5555
> Fax 03 8610 0050
> Click here to find me online:
> PHPTAL mailing list
PHPTAL mailing list