Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Fastest template engine

188 views
Skip to first unread message

Andriy Kornatskyy

unread,
Sep 23, 2012, 5:24:36 AM9/23/12
to pytho...@python.org

I have run recently a benchmark of a trivial 'big table' example for various python template engines (jinja2, mako, tenjin, tornado and wheezy.template) run on cpython2.7 and pypy1.9...... you might find it interesting:

http://mindref.blogspot.com/2012/07/python-fastest-template.html

Comments or suggestions are welcome.

Thanks.

Andriy Kornatskyy

Andriy Kornatskyy

unread,
Sep 25, 2012, 8:27:59 AM9/25/12
to pytho...@python.org

The post has been updated due to comment from Makoto Kuwata (author of tenjin) related to use of optimized version of HTML escape in tenjin templates.

I believe Mako and Jinja2 both are using MarkupSafe which serves exactly for that purpose there.

The test assert the output is unicode.

http://mindref.blogspot.com/2012/07/python-fastest-template.html

Thanks.

Andriy


----------------------------------------
> From: andriy.k...@live.com
> To: pytho...@python.org
> Subject: Fastest template engine
> Date: Sun, 23 Sep 2012 12:24:36 +0300
> --
> http://mail.python.org/mailman/listinfo/python-list

Andriy Kornatskyy

unread,
Sep 26, 2012, 9:21:21 AM9/26/12
to pytho...@python.org

The post has been updated with the following template engines added (per community request):

1. chameleon
2. django
3. web2py

Here is a link:

Jean-Michel Pichavant

unread,
Sep 26, 2012, 12:10:24 PM9/26/12
to Andriy Kornatskyy, pytho...@python.org
----- Original Message -----
>
> The post has been updated with the following template engines added
> (per community request):
>
> 1. chameleon
> 2. django
> 3. web2py
>
> Here is a link:
>
> http://mindref.blogspot.com/2012/07/python-fastest-template.html
>
> Comments or suggestions are welcome.
>
> Thanks.
>
> Andriy

http://www.cherrypy.org is quite popular as well.

JM

PS : please don't top post


Jean-Michel Pichavant

unread,
Sep 26, 2012, 12:11:45 PM9/26/12
to Andriy Kornatskyy, pytho...@python.org
Kindly ignore my post, I don't know why, I read web framework instead of template engine.

JM

alex23

unread,
Sep 26, 2012, 8:33:24 PM9/26/12
to
On Sep 27, 2:12 am, Jean-Michel Pichavant <jeanmic...@sequans.com>
wrote:
> Kindly ignore my post, I don't know why, I read web framework instead of template engine.

Possibly because there's a parallel thread by Andriy on that topic :)

Andriy Kornatskyy

unread,
Oct 1, 2012, 11:24:57 AM10/1/12
to pytho...@python.org

1. Added benchmarks for python 3.3
2. Captured total numbers of calls made by corresponding template engine and number of unique functions used.
Andriy


----------------------------------------
> From: andriy.k...@live.com
> To: pytho...@python.org
> Subject: Fastest template engine
> Date: Sun, 23 Sep 2012 12:24:36 +0300
>
>
> I have run recently a benchmark of a trivial 'big table' example for various python template engines (jinja2, mako, tenjin, tornado and wheezy.template) run on cpython2.7 and pypy1.9...... you might find it interesting:
>
> http://mindref.blogspot.com/2012/07/python-fastest-template.html
>
> Comments or suggestions are welcome.
>
> Thanks.
>
> Andriy Kornatskyy
> --
> http://mail.python.org/mailman/listinfo/python-list

Andriy Kornatskyy

unread,
Oct 19, 2012, 4:34:41 AM10/19/12
to pytho...@python.org

Per community request cheetah has been added to benchmark. Post updated, just in case:

http://mindref.blogspot.com/2012/07/python-fastest-template.html

Comments or suggestions are welcome.

Andriy


----------------------------------------
> From: andriy.k...@live.com
> To: pytho...@python.org
> Subject: RE: Fastest template engine
> Date: Wed, 26 Sep 2012 16:21:21 +0300
>
>
> The post has been updated with the following template engines added (per community request):
>
> 1. chameleon
> 2. django
> 3. web2py
>
> Here is a link:
>

Andriy Kornatskyy

unread,
Oct 23, 2012, 8:45:56 AM10/23/12
to pytho...@python.org

Python template engines offer high reusability of markup code and the following features are used by content developers most of the time:

* Includes: useful to incorporate some snippets of content that in most cases are common to the site, e.g. footer, scripts, styles, etc.

* Extends: useful to define a master layout for the majority of the site content with placeholders, e.g. sidebar, horizontal menu, content, etc. The content developers extend the master layout by substituting available placeholders.

* Widgets: usually small snippets of highly reusable markup, e.g. list item, button, etc. The content developers use widgets to increase readability and enforce consistency of design.

All mentioned features above are examined for various template engines (django, jinja2, mako, tornado and wheezy.template) in the following post:

http://mindref.blogspot.com/2012/10/python-templates-benchmark.html

The test is executed in isolated environment using CPython 2.7 but can be run for Python 3.3 and/or PyPy 1.9. Source code is here:

https://bitbucket.org/akorn/helloworld

Comments or suggestions are welcome.

Thanks.

Andriy


----------------------------------------
> From: andriy.k...@live.com
> To: pytho...@python.org
> Subject: RE: Fastest template engine
> Date: Fri, 19 Oct 2012 11:34:41 +0300
> --
> http://mail.python.org/mailman/listinfo/python-list

Andriy Kornatskyy

unread,
Dec 24, 2012, 5:12:21 AM12/24/12
to pytho...@python.org

Per community request I have added tenjin to the templates benchmark and updated with latest version of other template engines.

Just in case here is a link:

http://mindref.blogspot.com/2012/10/python-templates-benchmark.html

Thanks.

Andriy Kornatskyy


----------------------------------------
> From: andriy.k...@live.com
> To: pytho...@python.org
> Subject: RE: Fastest template engine
> Date: Tue, 23 Oct 2012 15:45:56 +0300
> --
> http://mail.python.org/mailman/listinfo/python-list
0 new messages