PHP Template Engine Comparison

speed matter ... sometimes ...


updated on Mar 25 2012 at 02:26 AM

A blogger asked me "Do you know any professional benchmarks for templates?" So I made this one. Now, this project is getting the attention of the international PHP developers community, which is divided in two. One says PHP itself is the best template engine, the other says PHP needs template engines. With these benchmark & charts you can compare the performances of template engines vs PHP templates, and make your choice.


This benchmark is performed by executing an assignment and a loop test. Each template engine is executed 10 times foreach single test. The test is executed on compiled template. The charts shows the average execution time and memory consumed for each test. Have fun!


click here to download this benchmark



                   

Summary (loop)

Test tot. time tot. memory package size
php 5.2.17 1505 µs 39.87 KB 4 KB
raintpl 2.7.0 5462 µs 214.28 KB 37 KB
twig 1.5.1 13097 µs 515.68 KB 647 KB
smarty 3.1.7 16393 µs 900.07 KB 971 KB

Execution Time (loop)

Memory (loop)

Total average (loop)

This chart works reversed, so the smaller is the pie the faster is the template engine!

Share it if you like it!