Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save headius/713293 to your computer and use it in GitHub Desktop.
Save headius/713293 to your computer and use it in GitHub Desktop.
Patches to move plugin loading to gem_runner, to speed startup.
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
-
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
~/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
@kares
Copy link

kares commented Nov 24, 2010

that is aasome - hope to see it soon in 1.5.x

@jfirebaugh
Copy link

What's the status on this? I can't find any discussion on the rubygems mailing list.

@headius
Copy link
Author

headius commented Dec 20, 2010

Apparently they attempted to do this or a similar change and it broke something else. I have no idea what the status is, and I don't have the cycles right now to follow up. Perhaps post a message to rubygems dev list and see if they can update you on progress? We're really like to ship this change for JRuby 1.6, but we don't want to hack RubyGems too much in a release.

@headius
Copy link
Author

headius commented Dec 22, 2010

I've started a thread about this on the rubygems dev list.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment