Ian Bicking: the old part of his blog

Re: Re python templating languages comment 000

I love PyMeld and think its a fantastic system, but in real life situations it is extremely slow in my experience. At some stage I will try and do some formal benchmarks but for a recent project (http://muti.co.za) I started off using PyMeld and then abandoned it. I found that in generating a table with multiple rows (around 30 or so) using the recipe described by the PyMeld author, it was two orders of magnitude slower than Pythons "%" native templates.

I then tried Cheetah, and although it is faster than PyMeld to my horror I found that it is 1 order of magnitude slower than straight "%" templates. This was Cheetah 1.0 (At the time I did this 2.0RC1 was out but I didnt try it). I at first thought this was because I wasnt using the compilation functionality but I found that compiling the templates produced very little difference with the same 30 line table.

I also tried the new Python 2.4 template engine in the string module, and this was disapointing in that it was marginally slower than % templates and also has no support for numeric formatting. I probably could have used Cheetah but I am very picky about performance and in the end I could not justify an order of magnitude performance hit so I am using straight % templates until I can find a higher performing template engine.

Comment on Re python templating languages comment 000
by thakadu


meld3 might be faster than PyMeld. For Cheetah, you lose a lot of performance with NameMapper -- if you don't use it (try taking out $'s) it might speed up significantly.

# Ian Bicking