开发者

Speed comparisons between Chameleon and Jinja2

开发者 https://www.devze.com 2023-02-16 22:15 出处:网络
Has anyone here done any benchmarking of Chameleon versus Jinja2, in respect to performance? I\'m more used to the Jinja syntax开发者_StackOverflow中文版, since I come from Django, but as Pyramid sugg

Has anyone here done any benchmarking of Chameleon versus Jinja2, in respect to performance? I'm more used to the Jinja syntax开发者_StackOverflow中文版, 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.


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.


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


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

0

精彩评论

暂无评论...
验证码 换一张
取 消