The Xslate engine is designed, and performs best in, a persistent environment where the same instance of Text::Xslate can be reused, and where the intermediary data structure can be cached.
In this page we will show you benchmarks from two different scenarios. One is for a persistent environemnt like FastCGI and Starman. The other is for a non-persistent environment, perhaps when using from a command line tool or in CGI script.
If you're looking for a more thorough comparison for the template engines available for Perl5, you probably should look at Sam Graham's Perl Template Roundup
Here's the graph showing the benchmark results for a "rich" environment. You can see that Xslate performs at a pace unparalleled by any other template engine, coming to at least 30 times faster its nearest competitor.
This benchmark assumes the following:
- You have access to a C compiler, therefore you are free to use XS-based modules
- You can reuse the same instance of each template engines
The benchmark script (found here), simply uses each template engine to list a set of data. In this case we're repeating the same data 100 times per template.
Here's the graph showing the benchmark results for a "poor" environment. Unlike the "rich" environment, here Xslate only performs slightly faster than TT2, and Text::MicroTemplate comes out as a clear winner.
This benchmark assumes, or is limited by, the following criteria:
- Instances for each engine are created for every run, just like a CGI script would do.
- You DO NOT have access to a C compiler.
- Modules that require an XS backend are excluded. ClearSilver is not used, and HTML::Template is used instead of HTML::Template::Pro.
The benchmark script (found here) is equivalent to x-rich-env.pl with the caveats mentioned above.