1 Post for April 2009

More Haml Benchmark Issues

Posted April 7, 2009

This morning I got a bit of an unpleasant surprise in my feed reader. had pointed out an interesting line in the longstanding ERB file that we use as a baseline against which to test Haml’s performance. The two files are supposed to be as similar as the difference in language permits, but Magnus pointed out a serious discrepancy.

The relevant line in the ERB file was <%= line %>, but the one in the Haml file was - line. That is, the ERB variable was being concatenated to the document, but the Haml variable was not. Which means the ERB benchmark was doing a lot more work than the Haml benchmark.

The upshot of all this is that all previous benchmark results are invalidated; in particular, Haml is significantly slower than I had thought and indicated. The previous benchmarks indicated that Haml was slightly faster than ERB for similar documents. Now according to my benchmarks Haml 2.0 is 3.24 times slower than ERB, or 2.42 times slower with the :ugly option enabled.