Created
November 24, 2010 07:53
-
-
Save headius/713293 to your computer and use it in GitHub Desktop.
Patches to move plugin loading to gem_runner, to speed startup.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| diff -u -r ../jruby-1.5.1/lib/ruby/site_ruby/1.8/rubygems/gem_runner.rb lib/ruby/site_ruby/1.8/rubygems/gem_runner.rb | |
| --- ../jruby-1.5.1/lib/ruby/site_ruby/1.8/rubygems/gem_runner.rb 2010-06-06 10:49:08.000000000 -0500 | |
| +++ lib/ruby/site_ruby/1.8/rubygems/gem_runner.rb 2010-11-24 01:51:28.000000000 -0600 | |
| @@ -76,3 +76,19 @@ | |
| end | |
| +plugins = Gem.find_files 'rubygems_plugin' | |
| + | |
| +plugins.each do |plugin| | |
| + | |
| + # Skip older versions of the GemCutter plugin: Its commands are in | |
| + # RubyGems proper now. | |
| + | |
| + next if plugin =~ /gemcutter-0\.[0-3]/ | |
| + | |
| + begin | |
| + load plugin | |
| + rescue => e | |
| + warn "error loading #{plugin.inspect}: #{e.message} (#{e.class})" | |
| + end | |
| +end | |
| + | |
| diff -u -r ../jruby-1.5.1/lib/ruby/site_ruby/1.8/rubygems.rb lib/ruby/site_ruby/1.8/rubygems.rb | |
| --- ../jruby-1.5.1/lib/ruby/site_ruby/1.8/rubygems.rb 2010-06-06 10:49:08.000000000 -0500 | |
| +++ lib/ruby/site_ruby/1.8/rubygems.rb 2010-11-24 01:51:10.000000000 -0600 | |
| @@ -1100,19 +1100,3 @@ | |
| Gem.clear_paths | |
| -plugins = Gem.find_files 'rubygems_plugin' | |
| - | |
| -plugins.each do |plugin| | |
| - | |
| - # Skip older versions of the GemCutter plugin: Its commands are in | |
| - # RubyGems proper now. | |
| - | |
| - next if plugin =~ /gemcutter-0\.[0-3]/ | |
| - | |
| - begin | |
| - load plugin | |
| - rescue => e | |
| - warn "error loading #{plugin.inspect}: #{e.message} (#{e.class})" | |
| - end | |
| -end | |
| - |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| diff --git a/lib/ruby/site_ruby/1.8/rubygems.rb b/lib/ruby/site_ruby/1.8/rubygems.rb | |
| index 665b785..95b2097 100644 | |
| --- a/lib/ruby/site_ruby/1.8/rubygems.rb | |
| +++ b/lib/ruby/site_ruby/1.8/rubygems.rb | |
| @@ -1135,6 +1135,3 @@ require 'rubygems/config_file' | |
| require 'rubygems/custom_require' if gem_disabled or RUBY_VERSION < '1.9' | |
| Gem.clear_paths | |
| - | |
| -Gem.load_plugins | |
| - | |
| diff --git a/lib/ruby/site_ruby/1.8/rubygems/gem_runner.rb b/lib/ruby/site_ruby/1.8/rubygems/gem_runner.rb | |
| index 07a792d..48c9853 100644 | |
| --- a/lib/ruby/site_ruby/1.8/rubygems/gem_runner.rb | |
| +++ b/lib/ruby/site_ruby/1.8/rubygems/gem_runner.rb | |
| @@ -76,3 +76,4 @@ class Gem::GemRunner | |
| end | |
| +Gem.load_plugins | |
| \ No newline at end of file |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ~/projects/jruby ➔ ls lib/ruby/gems/1.8/gems/ | wc -l | |
| 471 | |
| ~/projects/jruby ➔ time jruby -rubygems -e 1 | |
| real 0m5.079s | |
| user 0m7.375s | |
| sys 0m0.393s | |
| ~/projects/jruby ➔ git stash pop --quiet | |
| ~/projects/jruby ➔ time jruby -rubygems -e 1 | |
| real 0m1.125s | |
| user 0m1.401s | |
| sys 0m0.139s |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I've started a thread about this on the rubygems dev list.