Rails with Ruby 1.9.1
I’ve spent the past week playing around with various RoR deployment setups. I thought about tediously benchmarking each setup, but since I’ve decided to stick with Rails 2.3.5 and Ruby 1.8.7, I’ll just share a little bit about what I learned along the way:
First of all, there is Rails 3.0 beta. Given the fact that I had enough troubles with Rails 2.3.5 and Ruby 1.9.1 which are supposed to be “stable”, only start a new project in Rails 3.0 if you like running into lots of bugs.
First of all, why would someone want to use Ruby 1.9.1? Speed. Keep in mind, if you compile ruby from source, it will run faster than if you use a package-managed version like you get with yum or apt-get. Here are some bogus benchmarks to give you an idea of the speed difference:
Ruby 1.8.7 (installed from apt-get) : 6.4 seconds
Ruby 1.8.7 (installed from source) : 5.2 seconds
Ruby enterprise edition (installed from source) : 5.8 seconds
Ruby 1.9.1 (installed from apt-get) : 4.1 seconds
Ruby 1.9.1 (installed from source) : 3.2 seconds
However, if RAM is your concern (as it very well might be with many rails apps), you don’t seem to gain anything from running 1.9.1 vs 1.8.7. Only ruby enterprise edition uses less RAM (at the cost of a slower, better garbage collector).
OK, so Ruby 1.9.1 is the fastest, and rails passes all tests with it, so why wouldn’t you want to use it? Here are the reasons:
1. Many gems /plugins still don’t support Ruby 1.9.1 yet. Ruby 1.9.1 is not back-compatible with Ruby 1.8.7. Here are some plugins I hand trouble with: jrails, uberkit, bundle-fu.
2. “ruby-debug” will never be compatible with ruby 1.9. There is ruby-debug19, but I ran into problems with for some reason it looked like rspec helpers were expecting “ruby-debug” to work.
3. Gems that install binaries make it more difficult for you to install gems under multiple versions of ruby.
4. Ruby 1.9 is different from 1.8, and you’ll start to find annoying display bugs in your old rails project. I recently learned that [].to_s is “[]” in 1.9, while it is “” in 1.8.
These might look like minor problems to you. Looking at them again, they don’t look so bad, and I’m tempted to go back into 1.9. The problem is just that I want to spend my time making a web app, and not futzing with little compatibility bugs that keep popping up. The reason I chose rails in the first place is to be more productive with web app development, so for that reason, I think I’m going to stick with 1.8.7 for a while, until some rock-solid admin recipes for 1.9+ come out… hopefully with rails 3.0+.
Trackbacks & Pingbacks