Using Text::Xslate as an alternative to Template::Toolkit?

Frédéric Buclin lpsolit at gmail.com
Tue Mar 6 19:17:58 UTC 2012


Hi all,

I asked in the Template::Toolkit mailing-list how to make our templates
faster. Besides telling me to use the TT cache, which we already do, and
use PROCESS as much as possible instead of INCLUDE, which we already do,
there were no really helpful solutions.

But someone replied to me privately that there is one possible
alternative to TT, which is the Text::Xslate module, available on CPAN:

  http://search.cpan.org/~gfuji/Text-Xslate/

This module has its own website, http://xslate.org/ which argues that
Text::Xslate is 150 times faster than TT in persistent environment (for
Bugzilla, this means when using mod_perl):

  http://xslate.org/benchmark.html

In mod_cgi environment, this module is only 1.5 times faster than TT,
based on their benchmarks.

Of course, we don't want to rewrite all our templates, especially before
knowing if it worths the effort, but the good news is that Text::Xslate
supports most of the TT syntax and methods thanks to
Text::Xslate::Syntax::TTerse and Text::Xslate::Bridge::TT2Like, see:

  http://search.cpan.org/~gfuji/Text-Xslate/lib/Text/Xslate/Syntax/TTerse.pm

http://search.cpan.org/~dmaki/Text-Xslate-Bridge-TT2Like/lib/Text/Xslate/Bridge/TT2Like.pod

The only drawback is that PROCESS and named BLOCK are not (yet)
supported, which we use heavily. Let's hope that a future version of
Text::Xslate will implement them.

Does any of you have any experience with Text::Xslate, and know how
mature and usable it is in real environments? And is the performance
really as impressive as it seems to be in their benchmarks? Depending on
how things go, we could propose it as an alternative to TT, e.g. through
a parameter in localconfig.


LpSolit



More information about the developers mailing list