2 Posts for November 2009

Sass Supports Rack

Posted November 22, 2009

I’ve just released Haml and Sass 2.2.14. There are a bunch of useful changes in there; a few bug fixes, a few very minor feature additions. But there’s one feature in particular that’s more exciting than the rest: Sass now has native support for all Rack-based frameworks.

Just put this in your config.ru:
require 'sass/plugin/rack'
use Sass::Plugin::Rack

The Sass Rack plugin works just like the Rails and Merb plugins. Every request, it looks for Sass files in public/stylesheets/sass and compiles them to CSS files in public/stylesheets if necessary. These paths can be configured like so:

Sass::Plugin.options[:css_location] = "./stylesheets" 
Sass::Plugin.options[:template_location] = "./sass"

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.