Ruby 1.9.1 Preview Released: Why This Is A Big Deal
In an understated post on the official Ruby blog last night, Yugui (Yuki Sonoda) announced the release of Ruby 1.9.1-preview 1.
Why To Get Excited
A preview release? Why is this a big deal? A few reasons why Ruby 1.9.1 is significant, even as a preview release:
- Ruby 1.9.1 will be the first stable, production-ready release of the much anticipated Ruby 1.9 series.
- The Ruby 1.9 branch is the cornerstone of Ruby's future. Much as PHP 5-style code is replacing PHP 4-style code, Ruby 1.9's idioms and style will eventually reign (even if it takes a few years).
- As of Ruby 1.9.1-preview 1, the language features and changes are effectively "frozen." Changes to standard libraries for multilingual features are likely to continue, however.
- Ruby 1.9.1-preview 1 allows you - as a developer - to test your code and libraries on what will eventually become the "default" Ruby.
On that last point, as Dave Thomas says in his release summary:
If you are the maintainer for any publicly available Ruby code (be it a Gem, an application, or whatever) I strongly urge you to download this preview. You'll be doing the community a great service in two ways. First, the various incompatibilities between 1.9 and 1.8 mean that there's a chance that your code may not work without some tweaks. Making those changes now will help others using your code.
Getting Ruby 1.9.1-preview 1
You can get Ruby 1.9.1-preview 1 in source form from the official ruby-lang.org FTP site at ftp://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.1-preview1.tar.gz or via HTTP from http://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.1-preview1.tar.gz
If you find the ruby-lang.org server slow - as I do - I've made the .tar.gz available here from Amazon S3, so you should be able to download it at full speed.
Ruby 1.9 Resources
When Ruby 1.9 was still quite new, James Edward Gray wrote the excellent "Getting Code Ready for Ruby 1.9." Much of it is still very relevant.
Almost a year ago, Sam Ruby wrote a comprehensive set of notes on porting REXML to Ruby 1.9.
Mauricio Fernandez's gargantuan "Changes in Ruby 1.9" is still an excellent reference.
Got any Ruby 1.9 migration tips or tricks of your own? Please, leave a comment!
Supported by: ActionGear is a menu-bar app for task management on your Mac. It's lightweight, quick, and helps you get stuff done. Try it out for free.
October 29, 2008 at 9:34 pm
Is it possible to run rails on ruby 1.9.1?
October 30, 2008 at 4:48 am
Rails 2.2 will run on Ruby 1.9. I don't know about the current versions of Rails.
October 30, 2008 at 8:04 am
@Justin: I believe it is, at least rails 2.2 if I'm correct. But quite some gems/plugins aren't ready yet, so it really depends on your gem-needs.
October 30, 2008 at 9:58 am
with rails > 2.2.0, may be.
October 31, 2008 at 7:34 pm
Production ready, my a$$. You'd have to be fscking nuts to run any 1.9.x branch in production use at this point. When it's officially dubbed 2.0 then, and only then, should you even remotely consider using it for production.
October 31, 2008 at 10:16 pm
From what I understand, 2.0 will be further off than previously reported and including even more new features, and 1.9.1 will be the stable version for 1.9. At least, that's what Matz told us at LoneStar Ruby Conf this year...
November 3, 2008 at 1:43 pm
This is very great, I tried it and it speeds up my Ruby/SDL game by 100%. :)
However I would like to send an important message to all people who are writing Ruby extensions using the C API: update your code. Check for any place where you use RArray *arr; arr->ptr and arr->len. Now, it's not possible to use these anymore, you must use RARRAY_PTR(arr), and RARRAY_LEN(ary), like you should have. I've seen this problem several times now, and I think it's due to the fact that many people didn't know that directly using RArray was deprecated, even in ruby 1.8.6.
November 5, 2008 at 3:56 pm
running some tests on 1.8 vs. 1.9.1 :
the testing function:
def prof(t = 1)
starting_time = Time.now
t.times { yield }
dlta = (Time.now - starting_time).to_f/t
puts "time: #{dlta.to_s}(s) . req/s: #{(1/dlta)}"
end
prof(100) {a = (1..10000).collect { |i| i* 2}}
1.8: time: 0.02187848(s) . req/s: 45.707014381255
1.9: time: 0.00216260594(s) . req/s: 462.405092626352
a = (1..10000).collect { |i| i* 2}
b = (5000..15000).collect { |i| i* 2}
prof(1000) {a & b}
1.8: time: 0.00321087(s) . req/s: 311.442070217729
1.9: time: 0.004361395498(s) . req/s: 229.284411482189
Ruby 1.9 showed amazing speed increase on many other parameters, that's true. I'm sure that in general it will boost performance amazingly. Yet I guess it can be even better.
(Thanks Boris (Peterbarg) for helping on this one!)