Edgewall Software

Version 13 (modified by cmlenz, 15 years ago) (diff)

Update SimpleTAL entry

Performance of the Markup Template Engine

The directory examples/bench has some very simple benchmarks to compare the performance of Markup to other template engines.

It should be noted that text-based template engines generally have a lot less work to do than XML-based ones, simply because their functionality is limited to processing text as opposed to processing markup.

Current results

All tests run under Python 2.4.3 on Mac OS X (MacBook 2GHz).

Template Engine Rendering time (less is better) Notes
Markup 3.96 ms
Markup + Speedups 3.47 ms Experimental Markup branch that implements some core portions in C.
Clearsilver 0.33 ms ClearSilver is a text-based template engine written in C.
Django 1.84 ms Text-based template engine that comes with the Django framework.
Kid 5.66 ms Kid templates are compiled to Python byte-code. The cElementTree implementation was used for this test, although using the Python implementation doesn't appear to make a significant difference.
SimpleTAL 3.13 ms Another XML-based template engine written in Python, based on the Zope template engine (TAL).

The test template is rather simple right now and doesn't make much use of the advanced features provided by either Markup or Kid, because then it would be impossible to implement an equivalent template using other template languages.

Another benchmark

There's another simple benchmark in the Markup repository: examples/basic. That example is however only implemented for Markup and Kid. Here are the numbers:

Template Engine Rendering time (less is better)
Markup 3.67 ms
Markup + Speedups 3.61 ms
Kid 9.45 ms

I'm not quite sure why the difference between Markup and Kid is so much more drastic in this example compared to the above. It does define more (and slightly more sophisticated) match templates, which would suggest that Markup implements those more efficiently. However, that's just a theory.