Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

A helper to dramatically speedup the time it takes to run a 'require rubygems'

branch: master

This branch is 0 commits ahead and 0 commits behind master

Fetching latest commit…

Cannot retrieve the latest commit at this time

README
A helper to dramatically speedup the time it takes to load rubygems.

i.e. it makes it so that "require 'rubygems'" no longer has to sap valuable time from your life.

Speed difference (windows box, lots of gem):

$ time ruby examples/require_rubygems_normal.rb
real    0m1.109s

$ time ruby examples/require_fast_start.rb
real    0m0.500s

Yea! Finally ruby script startup times that don't spend forever just reloading gem specs every single time...

It acts about the same as gem_prelude (prelude is 1.9 only currently) -- adds the paths of the highest version of each gem into your load path so they're ready to be required.

It is also good for 1.9 makes script startup faster.  To use it with 1.9 do an
$ export RUBYOPTS=-rfaster_rubygems

somewhere.

== installation ==

$ gem install faster_rubygems

== usage ==

require 'faster_rubygems' at the top of your script.

Or

1.9:
  $ export RUBYOPTS=-rfaster_rubygems

1.8:
  you can install it to be used by default thus:

  >> require 'rubygems'
  >> require 'faster_rubygems/install' # installs faster_rubygems to be use in place of normal rubygems when you do a "require 'rubygems'"

  # later, to revert back to normal, should you so desire:
  >> require 'rubygems'
  >> require 'faster_rubygems/uninstall'

  If all else fails in this process (it typically works fine), you can reinstall normal rubygems by running setup.rb from within its package.

== More Speed Comparisons ==

For those interested, speed difference example on linux (250 gems):

$ time ruby examples/require_rubygems_normal.rb
ruby examples/require_rubygems_normal.rb  0.57s user 0.05s system 85% cpu 0.726 total

$ time ruby examples/require_fast_start.rb
ruby examples/require_fast_start.rb  0.04s user 0.02s system 46% cpu 0.121 total

Note also that a few non conforming gems require the use of require 'rubygems' no matter what (they're pretty rare, though--you probably won't run into them, and I'm not aware of any).

Related projects:

http://github.com/fabien/minigems/tree/master
1.9's gem_prelude.rb
http://www.ruby-forum.com/topic/191673

Source/contact:
http://www.github.com/rdp/faster_rubygems
Something went wrong with that request. Please try again.