# \[ANN\] frubygems -- quicker loading rubygems:"spooky" version

**URL:** <https://www.ruby-forum.com/t/ann-frubygems-quicker-loading-rubygems-spooky-version/177935>\
**Category:** Ruby\
**Created:** [October 26, 2009, 10:44pm UTC](https://www.ruby-forum.com/t/ann-frubygems-quicker-loading-rubygems-spooky-version/177935 "2009-10-26T22:44:48Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![rogerdpack](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/45deac/32.png) [@rogerdpack](https://www.ruby-forum.com/u/rogerdpack)\
**Post date:** [October 26, 2009, 10:44pm UTC](https://www.ruby-forum.com/t/ann-frubygems-quicker-loading-rubygems-spooky-version/177935/1 "2009-10-26T22:44:48Z")

</div>

Please to announce release code-named “spooky” of fast rubygems.

Changelog:  
added ‘frubygems’  
as an additional require option

Synopsis:  
require ‘frubygems’ # takes about 1/5th the time of doing a require  
‘rubygems’

Essentially gem\_prelude for 1.8

README:

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

require ‘rubygems’ no longer has to sap valuable time from your life

inspired by a request from Yehuda K. [1] and 1.9’s fast gem\_prelude.

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 paths.

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.

== installation ==

git clone git://github.com/rogerdpack/faster\_rubygems.git  
ruby faster\_rubygems/install.rb # done!

== usage ==  
instead of  
require ‘rubygems’  
it’s either  
require ‘frubygems.rb’  
or  
require ‘rubygems\_fast.rb’  
(both do the same thing, first is to save key strokes)  
in your scripts.

If you were really clever I suppose you could figure out how to override  
the default rubygem behavior to do this, always  
🙂

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).

Note: you don’t need this for ruby 1.9, which already preloads via  
gem\_prelude, but it won’t hurt to use it in 1.9–it  
defaults to a no-op, so doesn’t hurt.

---

<div class="post-metadata">

**Author:** ![rogerdpack](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/45deac/32.png) [@rogerdpack](https://www.ruby-forum.com/u/rogerdpack)\
**Post date:** [October 27, 2009, 3:54am UTC](https://www.ruby-forum.com/t/ann-frubygems-quicker-loading-rubygems-spooky-version/177935/2 "2009-10-27T03:54:32Z")

</div>

On Oct 26, 6:44 pm, Roger P. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Essentially gem\_prelude for 1.8
> 
> git clone git://github.com/rogerdpack/faster\_rubygems.git  
> ruby faster\_rubygems/install.rb # done!

Roger: your username is no longer that, is rdp.

So the command ends being:

git clone git://github.com/rdp/faster\_rubygems.git

---

<div class="post-metadata">

**Author:** ![rogerdpack](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/45deac/32.png) [@rogerdpack](https://www.ruby-forum.com/u/rogerdpack)\
**Post date:** [October 28, 2009, 7:24pm UTC](https://www.ruby-forum.com/t/ann-frubygems-quicker-loading-rubygems-spooky-version/177935/3 "2009-10-28T19:24:57Z")

</div>

> so it ends up being git clone git://github.com/rdp/faster\_rubygems.git

oops yep thanks for the correction.

> This returns an Array
> 
> # handle ENV[‘GEM\_PATH’] if it exists
> 
> gem\_paths \<\< ENV[‘GEM\_PATH’].split(’:’).select{|path| path + ‘/.gems’}  
> if ENV[‘GEM\_PATH’] # TODO should this override or supplement?
> 
> so you end up with a gem\_paths with Strings and an Array at the end.  
> Blows up at line 21.

gotcha so I misused \<\< I believe.  
Should be fixed now give it a shot.  
git clone git://github.com/rdp/faster\_rubygems.git  
-=r

---

<div class="post-metadata">

**Author:** ![rogerdpack](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/45deac/32.png) [@rogerdpack](https://www.ruby-forum.com/u/rogerdpack)\
**Post date:** [October 27, 2009, 6:27pm UTC](https://www.ruby-forum.com/t/ann-frubygems-quicker-loading-rubygems-spooky-version/177935/4 "2009-10-27T18:27:22Z")

</div>

On Tue, 27 Oct 2009 06:44:50 +0900, Roger P. wrote:

> Please to announce release code-named “spooky” of fast rubygems.

I think I found a bug in install.rb, line 12

This returns an Array

# handle ENV[‘GEM\_PATH’] if it exists

gem\_paths \<\< ENV[‘GEM\_PATH’].split(’:’).select{|path| path + ‘/.gems’}  
if ENV[‘GEM\_PATH’] # TODO should this override or supplement?

so you end up with a gem\_paths with Strings and an Array at the end.  
Blows up at line 21.

Fix:  
19 for gem\_path in gem\_paths.flatten do

🙂

This should afflict all RVM users that uses a non-standard location for  
their gems/libs.
