Despite the title, it’s about ruby rather than rails. So I decided to post this translation on the Rubi blog.The latest releases of MRI Ruby show a significant slowdown when connecting files.

For example, our average rail application when loading makes require about 2200 times - this is somewhere completely on the right side of the chart. Absolutely no good. At 1.9.2, the application starts in 20 seconds, and at 1.9.3 it is already 46. Too slow!
There are several reasons for this, but the main one is the require algorithm, which looks like this:
def require(file) $loaded.each do |x| return false if x == file end load(file) $loaded << file end
')
All brakes come from the cycle, and the more files we connect, the more it slows down. I wrote a patch for 1.9.3, which replaces the brake cycle with something like this:
def require(file) return false if $loaded[file] load(file) $loaded[file] = true end
And it gives about the following result:

Much nicer!
These are graphs of synthetic test for connecting empty files, but the patch accelerates in real projects. My
application now loads about 10 seconds. At 1.9.2 it was loaded 20. An empty application loads in general in 1.1 seconds, which is even faster than in 1.8.7

How to patch
It's all quite simple, it will take no more than 10 minutes, if you have installed RVM.
How can I help
I need to get as much attention as possible to the patch before it is included in the main trunk. It would help a lot if you:
- We tried the patch on our applications and wrote off the execution time of benchmarks in the comments
- We looked at the code in pull-rekveste on github (language C, but I hope that no one will be scared)
- Tried on windows
- Reported bugs that you find
What's next
I believe that before the inclusion of this patch in 1.9.3 is still far away, a lot of work remains to be done, but still, this is the first of many steps aimed at accelerating the launch of applications on rails. There are Bundler and RubyGems, which spend a lot of time is not clear on what - I would like to explore their insides.
I also plan to port this patch to JRuby, since there are similar problems there. In Rubinius, it seems, initially this is all right.