A few days ago I told the story of ruby-head (MRI) getting 36% faster loading, perfect for tackling those file-heavy Rails 3 apps. Awesome for Ruby 1.9.3 but not so good for us now, right? Todd Fisher to the rescue! He's created a patch backporting the performance tweak to Ruby 1.9.2-p180.
As the current production version of Ruby, a boost for Ruby 1.9.2-p180 should benefit most of you so I knew I had to share Todd's work as soon as I'd given it a test run. I ran the same benchmarks as in my earlier post and got a reduction in Rails 3 app load time of:
- 16.7% for the empty Rails 3 app
- 23.6% for the 'larger' in-production Rails 3 app

Only ~20% faster compared to ruby-head's 35%? That's actually good news! It means ruby-head (and so, hopefully, 1.9.3) has some extra performance boosts beyond the loading stuff - awesome! (Bear in mind in the previous post I benchmarked ruby-head with the patch against normal 1.9.2-p180.)
Now, The HowSo how do you get this stuff? First, you need to be using RVM to manage your Ruby installs. You'll need to figure things out for yourself if you're compiling Ruby by hand. If you're using other forms of package management, you might find this all a bit 'hacky' and want to give it a miss.
Obligatory disclaimer: Don't do this unless you have a basic idea of what you're doing. And if your performance isn't improved, don't blame us. Boring bit over.
OK RVM users, do this:
curl https://raw.github.com/gist/1008945/7532898172cd9f03b4c0d0db145bc2440dcbb2f6/load.patch > /tmp/load.patch rvm get head # always good to make sure you're up to date with RVM rvm reload rvm install ruby-1.9.2-p180 --patch /tmp/load.patch -n patched rvm use ruby-1.9.2-p180-patched
Note: You can just use ruby-1.9.2-patched but I'm playing it safe in the example ;-)
Note 2: Someone has reported that the above has resulted in an error at the patching stage. I've run it on two machines now without any problems but if you have problems, look at the log file RVM tells you to check out. It might give you a hint. Feel free to post a comment on this post too.
And now you're on the 'patched' Ruby 1.9.2. You'll need to run bundle again in your project(s) but in theory everything should work as before, just with faster loading.
So Todd Fisher just made your Rails 3 app start up somewhere around 20% faster without making you move away from a reliable, production version of Ruby. Buy the guy a beer when you see him next.
[ad] RailsKits is here to bring you great ready-made Rails code for you to use in your projects. More than just plugins, these starter kits can act as the foundation of your new Rails application. You can save hours of time, skipping the boring stuff and diving right into the code that makes your application different from all the rest.