The following Smarty benchmarks are executed in real time. Each iteration is fetched through port 80 on the web server, so the benchmark times you see include aspects like server connection, script execution, etc... basically everything a browser would see minus network latency. This method of benchmarking should be a fair depiction of the template engine comparisons. Depending on server traffic, file regeneration, etc. you may see varying results. Many of the engines are extremely close in speed, so try reloading the benchmarks a few times to get a sense of accuracy.
You can grab the sources of these benchmarks here.
How to install: (replace "nobody" with web server user) gtar -xvf smarty-benchmark.tar.gz chown nobody:nobody smarty-benchmark/*/*/templates_c/ chown nobody:nobody smarty-benchmark/*/*/cache/
php-accelerator is used on this web server. All of the template engines take advantage of the compilation caching. No server should be without one :-) If you want to view the benchmarks without php-accelerator, prepend /no-cache/ to the URL just after the server name.
I tried my best to setup each template engine efficiently. If you see any problems or a way to do something better, feel free to send me an e-mail: monte at ispi dot net.
Smarty is benchmarked with and without the cache enabled. These examples don't do the caching feature much justice since variable assignment is not coming from an expensive operation, such as a db query. The templates are also not so complex, it doesn't take much longer to parse the template than it does to fetch a cached copy.
ModeliXe is used with its caching feature turned on. I'm not sure how to disable it, but since it is on by default I left it alone.
Benchmark: var_assign
Each iteration of the var_assign benchmark assigns 50 template variables and parses/fetches the template. This is mixed with other text, as you can see in this example output.
var_assign 10 iterations
var_assign 25 iterations
var_assign 50 iterations
Benchmark: var_loop
Each iteration of the var_loop benchmark loop through a block 50 times and displays a template variable. This is mixed with other text, as you can see in this example output.
I was unable to figure out ultratemplate and pattemplate variable looping, so they are left out of this benchmark. If someone would like to create these benchmarks, I'll be glad to add them.
var_loop 10 iterations
var_loop 25 iterations
var_loop 50 iterations