~bohwaz/blog/

Avec de vrais morceaux de 2.0 !

Smarty vs. Smarty 3 vs. Template Lite vs. Dwoo

Smarty launched in the last days an alpha release of the version 3 of the template engine, claiming "very promising speed improvements over Smarty 2". OK, let's just see if it's true. I already did by the past a comparison between Smarty 2 and Template Lite. Since then a new template engine claiming compatibility with Smarty has surfaced, Dwoo, which looks very promising on features and implementation. So we'll test it as well here.

In short: Smarty 3 is always the slowest and most memory consuming engine, Dwoo is the fastest but consumes more memory than Template Lite. Smarty 3 is even slower and consumes more memory than Smarty 2, so it doesn't seem so good for "very promising improvements"... They have a lot of work before even a beta release.

In the tests below I tested each engine against a simple loading test with no template handling and three different templates, each tested without and with compilation before.

Template 1 : simple, no assign, just a few html tags and text (93B)

Template 2 : simple, one variable assign and display (105B)

Template 3 : foreach using an array with 6 rows and an escape modifier on each variable display (178B)



Loading and init of object variables



Smarty Smarty 3 Template Lite Dwoo
Memory
367KB
462KB 284KB 317KB
Time
0.042s 0.047s 0.044s 0.047s



Template 1, 10,000 fetch (not compiled before)



Smarty Smarty 3 Template Lite Dwoo
Memory
965KB
1,951KB
549KB
1,299KB
Time
2.141s
2.570s
1.536
1.624s
Compiled template size
201B
519B
234B
205B



Template 1, 10,000 fetch (compiled before)



Smarty Smarty 3 Template Lite Dwoo
Memory
369KB
491KB
286KB
461KB
Time
2.033s
2.472s
1.936s
1.505s



Template 2, 10,000 fetch (not compiled before)



Smarty Smarty 3 Template Lite Dwoo
Memory
966KB
1,964KB
550KB
1,299KB
Time
2.405s
3.190s
2.212s
1.709s
Compiled template size
243B
630B
275B
244B



Template 2, 10,000 fetch (compiled before)



Smarty Smarty 3 Template Lite Dwoo
Memory
369KB
493KB
287KB
461KB
Time
2.349s
2.992s
2.209s
1.644s



Template 3, 10,000 fetch (not compiled before)



Smarty Smarty 3 Template Lite Dwoo
Memory
1,013KB
2,030KB
573KB
1,361KB
Time
4.421s
6.938s
4.890s
3.609s
Compiled template size
784B
1060B
645B
690B



Template 3, 10,000 fetch (compiled before)



Smarty Smarty 3 Template Lite Dwoo
Memory
417KB
518KB
309KB
527KB
Time
3.899s
6.473s
4.964s
3.430s

Write a comment
(optional)
(optional)
(mandatory)
                       _                         
 _ __ ___   ___  _ __ | |_ __ _  __ _ _ __   ___ 
| '_ ` _ \ / _ \| '_ \| __/ _` |/ _` | '_ \ / _ \
| | | | | | (_) | | | | || (_| | (_| | | | |  __/
|_| |_| |_|\___/|_| |_|\__\__,_|\__, |_| |_|\___|
                                |___/            
(mandatory)

URLs will create links automatically.
Allowed HTML tags: <blockquote> <cite> <pre> <code> <var> <strong> <em> <del> <ins> <kbd> <samp> <abbr>

Alex

Slt,

Merci d'avoir pris le temps de faire ces mesures.

J'avais donc choisi Dwoo, vu qu'il est plus top que les autres.

Mais côté doc, c'est la dèche totale. Les exemples du Wiki sont misère.

As-tu un pointeur magique vers une doc + exemples ? oh oui, des exemples

Merci

Music Search

I personally like your post ; you have shared good insights and experiences. Keep it up. Nice work, thanks for sharing such an informative ideas.