Slim VS. Haml: Performance Perspective

Interesting & solid 🙂

sephinrothcn

 Background

Slim and Haml are two popular template language for Ruby on Rails, and there are many debates on which one is better all over the internet.

Luckily there are some benchmark tools on GitHub which may help to make a final decision.

I just pick up one from the official Slim GitHub repository: https://github.com/slim-template/slim

How-to Run Benchmark Test

Step 1: clone the code

Step 2: install haml and slim for your rubies

On this post is written the slim version is 2.0.2 and haml version is 4.0.5.
Step 3: run the benchmark and review the generated report

My Customized Benchmark Test

Default iteration is 1000, which makes the difference too small, so I update it to 100,000 in run-benchmarks.rb
Then I run 9 rounds of test under this configuration matrix:

Ruby 1.9.3Ruby 2.0.0Ruby 2.1.1
Rails 3.2.17√√√
Rails 4.0.4√√√
Rails 4.1.0√

View original post 562 more words

Leave a comment