Nebulent - software solutions

Nebulent

Edie (Enterprise Data Intelligence Engine) is our latest application that is specifically designed to help organization get up to speed with Amazon Mechnical Turk platform without going through a learning curve. No need to code or manage any spreadsheets. Design your tasks and push your data through our qualified work force to get fast results at fraction of a penny.

Contacts

Contact information

Toll Free: +1(888)201-7922

Blog

Making ruby to fly

In this nice blog post by Justin Kulesza, the author points out that ruby interpreter is compiled by RVM wthout any optimizations at all, and he suggests to add -O3 to CFLAGS. Without a doubt, this adds some performance boost to your ruby interpreter.

But, there are other tricks which you can use to improve the ruby performance.

Note: you need to recompile ruby if you add one of these “tweaks”

Processor-specific CFLAGS

Gentoo Wiki has a section about safe performance flags for your processor. I, for example have a Core Duo CPU, and the Intel section of cflags article says I need to use the following cflags:

CFLAGS="-march=prescott -O2 -pipe -fomit-frame-pointer"

Obviusly, I need to put these values where RVM will recognize them, so .rvmrcin my home directory should look like this:

rvm_configure_env=(CFLAGS="-march=core2 -O2 -pipe -fomit-frame-pointer")

Note: THESE COMPILER FLAGS ARE SAFE FOR MY PROCESSOR ONLY, YOU SHOULD FIND YOURS ON THE WIKI

Falcon patch

There is a gist on github, which addresses some of the performance issues ruby 1.9.3 has, and people are reporting up to 2X boost in some scenarios.

Latest versions of RVM knows about this patch, and all you have to do is to specify a flag to rvm when installing ruby:

rvm install 1.9.3-turbo --patch falcon

Result

Unfortunately, I do not have time to do some detailed tests, but here is a small benchmark result (which is not a very good indicator of performance difference).

The test:

time bundle exec rake routes in a big Rails project

(which is in fact the only scenario I wished would be faster in my daily dev life)

ruby 1.9.3 - 30.57s

ruby 1.9.3 -O2 - 23.68s

ruby 1.9.3 -O2 +custom cflags - 23.03s

ruby 1.9.3 -O2 +custom cflags +falcon patch - 6.99s

 

2012-11-22