Ruby 2.0 has been released, see:
http://www.ruby-lang.org/en/news/2013/02/24/ruby-2-0-0-p0-is-released/
What changes to my Rails App/Installation should I anticipate making after upgrading my system to Ruby 2.0?
Highlights in Rails 7.0: Ruby 2.7. 0+ required, Ruby 3.0+ preferred.
Rails 6 requires Ruby 2.5. 0 or newer. Rails 5 requires Ruby 2.2. 2 or newer.
So here's what I had to do after upgrading.
Bundler 1.2.x is not compatible, it raises an error saying to upgrade to >= 1.3, which is not yet release. So if you are using RVM, jump into your global gemset for the 2.0 ruby and upgrade to 1.3.pre version until 1.3.0 is released. Also it seems like there's something up with the rubygems api. My bundle install did not use the new API, instead doing the old 'fetch index' method, which of course takes a little bit longer.
Aside from that, my bundle did install cleanly, and my full set of spec tests completed with all OK. I did some timing tests to see how much the rails load time has improved.
# Using 1.9.3-p327
RSpec Time: 24.87s
Wall Time : 34.40s
Load Time : 9.53s
# Using 2.0.0-p0
RSpec Time: 22.49s (90.4%)
Wall Time : 26.89s (78.2%)
Load Time : 4.4s (46.2%)
Obviously the load time for rspec is a little heavier with all of the testing gems, but still over a 50% drop in load time and a 10% drop in test run time is nice.
I did a similar test using rails runner 'puts User.count'
which would skip the test bootstrapping.
1.9.3 : 7.27s
2.0.0 : 3.36s (46.2%)
Again, nice drop of over 50% :)
Kind of getting off track here... new toys do that I guess, but it seems like the only change I had to make was upgrading to a pre-release bundler.
Here's another test of different iterators
$ rvm 1.9.3-p327,2.0.0-p0 --verbose do ruby test.rb
ruby-1.9.3-p327: ruby 1.9.3p327 (2012-11-10 revision 37606) [i686-linux]
user system total real
for 0.610000 0.000000 0.610000 ( 0.607189)
times 0.580000 0.000000 0.580000 ( 0.587303)
upto 0.590000 0.000000 0.590000 ( 0.585730)
each 0.590000 0.000000 0.590000 ( 0.593494)
ruby-2.0.0-p0: ruby 2.0.0p0 (2013-02-24 revision 39474) [i686-linux]
user system total real
for 0.590000 0.000000 0.590000 ( 0.582743)
times 0.560000 0.000000 0.560000 ( 0.565961)
upto 0.560000 0.000000 0.560000 ( 0.562400)
each 0.570000 0.000000 0.570000 ( 0.573469)
Marginal, about a 4-5% gain.
More interesting is this, calling Object.new 500 million times
1.9.3 : 129.063s
2.0.0 : 97.234s
About a 25% drop in object creation time.
I started a new project with rails 4 and ruby 2.0. This is how I did it.
First, I set RVM to Ruby 2.0.
Then installed bundler 1.3:
$ gem install bundler
Updated these gems and 'bundle install'.
gem 'rails', :git => 'git://github.com/rails/rails.git'
gem 'journey', :git => 'git://github.com/rails/journey.git'
gem 'arel', :git => 'git://github.com/rails/arel.git'
group :assets do
gem 'sass-rails', :git => 'git://github.com/rails/sass-rails.git'
gem 'coffee-rails', :git => 'git://github.com/rails/coffee-rails.git'
end
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With