As I stated previously how much I like Genshi…I’ve come to realize that the performance of Genshi under high traffic is very bad. It could be the complexity of the templates that I am using, but I’m only using a few py:match’s and they are using once=“true”.
I decided to benchmark Mako against Genshi for my site. Both templates are identical minus the syntactical differences of Genshi vs. Mako. I used the Apache HTTP server benchmark to test the site. The site uses Pylons, SCGI, and Lighttpd.
NOTE: I did not use any caching for these tests.
Mako URL: http://blackberrytracker.com/ Genshi URL: http://blackberrytracker.com/index.genshi
Average Requests Per Second: 54.65
Average Requests Per Second: 1.69
As you can see from the graph below, not only is the response time for Genshi much higher, but the amount of requests fulfilled per second was about 50 times less than with Mako.
I also tested the template generation time for both Genshi and Mako. I used the render() method in Pylons for testing.
Mako: 3 ms(average) Genshi: 125 ms(average)
For the templates that I am using on my site it looks like using Mako is 40 times faster than Genshi.
I love Genshi but when it comes down to a high performance, high traffic site, it looks like Mako is a much better choice. I guess the tradeoff is using an XML vs. text based template language. I think I’ll be using Mako from now on, until Genshi becomes more mature and hopefully more optimized. Sorry Genshi!