Haml Benchmark Numbers for 2.2

Posted November 12, 2009

I realized today that I haven’t released Haml performance numbers in a while. In particular, there are no numbers out there for the Haml 2.2 release. This is reasonably important, since 2.2 increases performance pretty dramatically over 2.0, which was the version last benchmarked.

I’m also taking a statistics course, so you guys get fancy confidence intervals and such. So, without further ado, according to my benchmarks: Haml 2.2 without :ugly is 2.803 ± 0.036 times slower than ERB, or 1.018 ± 0.0124 slower with the :ugly option enabled. In addition, Haml 2.2 is 2.853 ± 0.029 times slower than Erubis, or 1.037 ± 0.010 times slower with the :ugly option enabled. And, because I have the data, ERB is 1.021 ± 0.0148 times slower than Erubis.

I’ve also got statistics for the master branch, which has a few optimizations for non-:ugly mode that aren’t present in 2.2. Haml master without :ugly is 2.665 ± 0.034 times slower than ERB.

Keep in mind when using these statistics that the time spent rendering a view is a relatively insignificant portion of the overall response time of an application, at least when it’s around the same order of magnitude as it is with Haml and ERB. Much more time can be saved by caching intelligently than by making the template engine faster. Nevertheless, Haml enabled the :ugly option by default in production, to eke out as much performance as possible.

Jacked said December 05, 2009:

It’s almost like you read my mind. I came to the comments page to ask how significant the template rendering performance is, in relation to a typical page view.

Lo and behold, there’s a paragraph addressing that very thing in the full post :)

I still haven’t used haml in an actual project, but I’m wanting to more and more.

Arun Agrawal said July 26, 2010:

Thanks for this benchmarks.

Bogdan Kulbida said December 23, 2010:

Thanks a lot! Great post.

Make your comments snazzy with Textile!