Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Try to activate only inactive gems #227

Closed
voxik opened this Issue · 3 comments

3 participants

@voxik

Hello,

Once the required file is not found by gem_original_require, RubyGems are going through all gems and tries to find which gem can contain the requested file. Unfortunately, it also goes through gems, which were already activated. However, for such gems, it makes no sense to look for some files to load, because their load paths are already available and the Ruby's require would be successful in that case. My simple patch [1] is trying to short-circuit the unnecessary search for files, and searches just the yet inactive gems. This patch should improve the RubyGems require performance, although I did not tested it. In theory, the more gems are activated, the faster should the require be.

[1] https://gist.github.com/1452549

@voxik

Alternative implementation could be extension of the original find_by_path to accept optional parameter with :active, :inactive and :all flags and the search would be modified according to this flag.

@zenspider zenspider was assigned
@zenspider
Owner

I like it, but it needs a test.

@voxik

Hi, the test can be found here: https://gist.github.com/1486087

However, I am not sure if the test itself shouldn't be protected by something like "save_loaded_features" which is used in require tests.

@evanphx evanphx closed this in abfb4b0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.