Speed comparisons between Chameleon and Jinja2
Asked Answered
T

3

12

Has anyone here done any benchmarking of Chameleon versus Jinja2, in respect to performance? I'm more used to the Jinja syntax, since I come from Django, but as Pyramid suggests to use Chameleon, I'm thinking if it would be nice to give it a try - despite having an awkward syntax, IMO.

Trichite answered 16/3, 2011 at 6:28 Comment(1)
Thank you for raising the issue. I'm building an HTML-to-Python-template transformation. TAL (Chameleon) should help not changing the structure of the original template (aka, non-intrusive). With TAL, we do not introduce non-xml element.Intracardiac
V
19

Template engines are rarely the cause of performance problems, even if chameleon is slightly faster than Jinja2 I doubt the effort of learning a new template language etc. is worth it.

Optimization of database queries and caching will probably result in more performance than you could gain by switching the template engine and take little effort.

Vivien answered 16/3, 2011 at 11:39 Comment(1)
+1. The database is much more likely to be a bottleneck than the templating engineSodom
G
5

I think they are pretty close, and each would probably win depending on the benchmark. I think it's better to pick a templating engine based on how much you like the syntax (I prefer pyTenjin) and how easy it is to integrate it into your own project/framework.

Jinja2 is similar to Mako in speed (~20x faster than Django): source

Chameleon is also about 20x faster than Django: source

And pyTenjin is also up there: source

Grabble answered 16/3, 2011 at 6:56 Comment(0)
H
4

Keep in mind that jinja2 also has an "official" set of pyramid bindings via pyramid_jinja2

The fact that Chamelon is anymore "core" than Jinja2 is mostly an artifact of pyramid's history of repoze.bfg

Handout answered 16/3, 2011 at 10:5 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.