Use Xavier Shay’s patched Ruby 1.9.3dev
There were two patches for Ruby 1.9 to resolve the load performance issue. Xavier Shay’s approach, which use a hash data structure to store loaded files, absolutely can result much better performance.
Use Xavier Shay’s patch may not easy, here is a small trick to install his fork of Ruby with rvm:
1 2 3 4 5 6 7 |
|
Yeah, it will be installed as ruby-head
.
Note: Absolutely this should only be used in development environment, since it’s a development version of Ruby 1.9.3.
Updated on Sep 28, 2011:
The official Ruby 1.9.3 rc1 was released recently, it has almost same load performance compared to Xavier Shay’s patched Ruby 1.9.3dev. Which make this trick no longer necessary.
Tweak Gemfile to not require unnecessary gems immediately
Most gems in development
and test
group are unnecessary to be required immediately, gems for test can be required in spec_helper.rb
. Here is part of my Gemfile for a small project:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
|
How about the result?
My recent project using Xavier Shay’s Ruby 1.9.3dev:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
|
Compare to another project using Ruby 1.8.7 (actually, ree-1.8.7-2011.03), without tweak Gemfile:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
|