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

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

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

Frédéric Buclin
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
-
To view or change your list settings, click here:
<http://bugzilla.org/cgi-bin/mj_wwwusr?user=lists@...>
Reply | Threaded
Open this post in threaded view
|

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

glob
Frédéric Buclin wrote:
But someone replied to me privately that there is one possible
alternative to TT, which is the Text::Xslate module, available on CPAN:

[...]

In mod_cgi environment, this module is only 1.5 times faster than TT,
based on their benchmarks.
for bugzilla with mod_cgi those gains will probably be lost by the overhead moose/mouse adds.
for mod_perl, we don't currently cache anything between requests; it may be better to investigate retaining compiled templates across requests, as well as looking into a backend (backed by mod_perl or memcached) for caching generated html fragments between requests.


-b
--
byron - <a class="moz-txt-link-freetext" href="irc:glob">irc:glob - bugzilla.mozilla.org team -

Reply | Threaded
Open this post in threaded view
|

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

Dave Miller
In reply to this post by Frédéric Buclin
Frédéric Buclin wrote on 3/6/12 2:17 PM:
> 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:

And that then leads to the question: Does using the Template Toolkit
compatibility modules negate the performance improvement?

--
Dave Miller                                   http://www.justdave.net/
System Administrator, Mozilla Corporation      http://www.mozilla.com/
Project Leader, Bugzilla Bug Tracking System  http://www.bugzilla.org/
-
To view or change your list settings, click here:
<http://bugzilla.org/cgi-bin/mj_wwwusr?user=lists@...>
Reply | Threaded
Open this post in threaded view
|

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

Frédéric Buclin
Le 07. 03. 12 05:40, David Miller a écrit :
> And that then leads to the question: Does using the Template Toolkit
> compatibility modules negate the performance improvement?

The templates are compiled by Text::Xslate, so the TT syntax is simply
parsed into something Text::Xslate will understand. It doesn't depend on
TT at all. So no performance penalty is expected.

LpSolit
-
To view or change your list settings, click here:
<http://bugzilla.org/cgi-bin/mj_wwwusr?user=lists@...>
Reply | Threaded
Open this post in threaded view
|

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

Dave Miller
In reply to this post by glob
Byron Jones wrote on 3/6/12 11:29 PM:

> Frédéric Buclin wrote:
>> But someone replied to me privately that there is one possible
>> alternative to TT, which is the Text::Xslate module, available on CPAN:
>>
>> [...]
>>
>> In mod_cgi environment, this module is only 1.5 times faster than TT,
>> based on their benchmarks.
> for bugzilla with mod_cgi those gains will probably be lost by the
> overhead moose/mouse adds.
>
> for mod_perl, we don't currently cache anything between requests; it may be better to investigate retaining compiled templates across requests, as well as looking into a backend (backed by mod_perl or memcached) for caching generated html fragments between requests.

We do a lot of user-specific stuff...  gotta wonder how much of the
caching is negated by the amount of data we throw at the templates which
changes for every user that looks at it...

--
Dave Miller                                   http://www.justdave.net/
System Administrator, Mozilla Corporation      http://www.mozilla.com/
Project Leader, Bugzilla Bug Tracking System  http://www.bugzilla.org/
-
To view or change your list settings, click here:
<http://bugzilla.org/cgi-bin/mj_wwwusr?user=lists@...>
Reply | Threaded
Open this post in threaded view
|

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

David Marshall-5



On 3/7/12 2:14 PM, "David Miller" <[hidden email]> wrote:

> Byron Jones wrote on 3/6/12 11:29 PM:
>> Frédéric Buclin wrote:
>>> But someone replied to me privately that there is one possible
>>> alternative to TT, which is the Text::Xslate module, available on CPAN:
>>>
>>> [...]
>>>
>>> In mod_cgi environment, this module is only 1.5 times faster than TT,
>>> based on their benchmarks.
>> for bugzilla with mod_cgi those gains will probably be lost by the
>> overhead moose/mouse adds.
>>
>> for mod_perl, we don't currently cache anything between requests; it may be
>> better to investigate retaining compiled templates across requests, as well
>> as looking into a backend (backed by mod_perl or memcached) for caching
>> generated html fragments between requests.
>
> We do a lot of user-specific stuff...  gotta wonder how much of the
> caching is negated by the amount of data we throw at the templates which
> changes for every user that looks at it...

In our just-replaced version at Y! (a bastardized 2.22), we were using
memcached for a number of things because of the scale involved. I'll be
adding some of them back in as I observe what's going on with our shiny new
3.6.

Our bugs table changes very frequently, so one thing we did was to add
SQL_NO_CACHE to all of the queries that involved table bugs. We did want to
use the query cache for most of the other tables, so we didn't want to
disable query caching altogether. That's a very marginal performance
improvement, but it's non-zero.

We were using memcached to cache the rows from longdescs for a bug, keyed by
bugs.delta_ts. I don't recall any specific performance metrics, but our hit
rate was fairly good.

I've thought about caching all of the HTML for show_bug.cgi (again based on
bugs.delta_ts), but we put a "readable time" on bugs (i.e. "6 days ago").
One way to get around this would be to generate the HTML with tags that
either are replaced before being sent to the browser or that are computed
client-side. It should be noted that we currently don't employ any
particular group security, so everyone basically gets the same page.

-
To view or change your list settings, click here:
<http://bugzilla.org/cgi-bin/mj_wwwusr?user=lists@...>
Reply | Threaded
Open this post in threaded view
|

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

glob
In reply to this post by Dave Miller
David Miller wrote:
Byron Jones wrote on 3/6/12 11:29 PM:
for mod_perl, we don't currently cache anything between requests; it may be better to investigate retaining compiled templates across requests, as well as looking into a backend (backed by mod_perl or memcached) for caching generated html fragments between requests.
We do a lot of user-specific stuff...  gotta wonder how much of the
caching is negated by the amount of data we throw at the templates which
changes for every user that looks at it...
we'd cache fragments of html, not the entire page.

for example, comments are immutable, so if we were to store the html-ised form in memcache, we could avoid a db lookup, linkification, and template rendering.




--
byron - <a class="moz-txt-link-freetext" href="irc:glob">irc:glob - bugzilla.mozilla.org team -

Reply | Threaded
Open this post in threaded view
|

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

Max Kanat-Alexander
In reply to this post by David Marshall-5
On 03/07/2012 02:43 PM, David Marshall wrote:
> I've thought about caching all of the HTML for show_bug.cgi (again based on
> bugs.delta_ts), but we put a "readable time" on bugs (i.e. "6 days ago").

        It's actually much more complex than that, too. See this bug:

        https://bugzilla.mozilla.org/show_bug.cgi?id=594962

        -Max
--
Max Kanat-Alexander
Chief Architect, Community Lead, and Release Manager
Bugzilla Project
http://www.bugzilla.org/
-
To view or change your list settings, click here:
<http://bugzilla.org/cgi-bin/mj_wwwusr?user=lists@...>