Thursday, May 14, 2009

Slow ruby 1.8 performance on MacBook Pro with Leopard

Recently I started to get really really bored about how sluggish my rspec-tests were running. The weird thing was: the specs run about 5 times faster on my iMac than on the MacBook. Same situation for loading the rails-environment (which is part of running the specs...).

After googling some time I found this blog entry by Barry Hess.

Conclusion: I followed the Hivelogic tutorial to install ruby. They recommend to compile ruby with certain options (e.g. --enable-pthread). This leeds to bad ruby performance on MacBooks (at least the model I have). If you compile ruby without any options, it runs much (and I mean much) faster. Loading the rails enviroment dropped from 5.5s to 1.5s. Specs also run about 5 times faster! If you're a test driven developer, you know what that means in terms of productivity.

I'm quite sure that a lot of rubyists have that problem, but are not aware of it.

Update: this article also applies for Snow Leopard.