R
Roger Pack
pleased to announce release of faster_rubygems 0.0.1
description:
A helper to dramatically speedup the time it takes to run
require 'rubygems'
inspired by a request from Yehuda Katz [1] and gem_prelude (and not
knowing if such a utility already existed or not...)
Example speed difference:
bash-3.1$ time ruby examples/require_fast_start.rb
real 0m0.500s
bash-3.1$ time ruby examples/require_rubygems.rb
real 0m1.109s
Yea! Finally ruby script startup times that don't spend forever just
reloading gem paths.
It acts about the same as gem_prelude does (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 ==
How to install (manual for now--with any interest I could make it
automatic):
find your rubygems.rb file:
ex from ubuntu:
/usr/local/lib/ruby/site_ruby/1.8/rubygems.rb
from doze:
c:\ruby18\lib\ruby\site_ruby\1.8\rubygems.rb
# copy some files into that same directory:
git clone git://github.com/rogerdpack/faster_rubygems.git
cp faster_rubygems/rubygems_*.rb /usr/local/lib/ruby/site_ruby/1.8
== usage ==
instead of
require 'rubygems'
it's
require 'rubygems_fast.rb'
or
require 'rubygems_f.rb' # shortcut to the first method.
Though if you were really clever I suppose you could figure out how to
override the default rubygem behavior to do this, always
Speed difference example on linux:
$ time ruby examples/require_rubygems.rb
real 0m0.086s
user 0m0.077s
sys 0m0.008s
$ time ruby examples/require_fast_start.rb
real 0m0.026s
user 0m0.016s
sys 0m0.008s
So better but not "such a big deal" as it is on windows boxes (where it
can use up to 50% of script time). Also note that that's on warm
start--cold start might show higher differences. And it's still a 4x
speedup
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).
Thanks!
-=r
[1]
http://rubyforge.org/tracker/index.php?func=detail&aid=21288&group_id=126&atid=578
description:
A helper to dramatically speedup the time it takes to run
require 'rubygems'
inspired by a request from Yehuda Katz [1] and gem_prelude (and not
knowing if such a utility already existed or not...)
Example speed difference:
bash-3.1$ time ruby examples/require_fast_start.rb
real 0m0.500s
bash-3.1$ time ruby examples/require_rubygems.rb
real 0m1.109s
Yea! Finally ruby script startup times that don't spend forever just
reloading gem paths.
It acts about the same as gem_prelude does (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 ==
How to install (manual for now--with any interest I could make it
automatic):
find your rubygems.rb file:
ex from ubuntu:
/usr/local/lib/ruby/site_ruby/1.8/rubygems.rb
from doze:
c:\ruby18\lib\ruby\site_ruby\1.8\rubygems.rb
# copy some files into that same directory:
git clone git://github.com/rogerdpack/faster_rubygems.git
cp faster_rubygems/rubygems_*.rb /usr/local/lib/ruby/site_ruby/1.8
== usage ==
instead of
require 'rubygems'
it's
require 'rubygems_fast.rb'
or
require 'rubygems_f.rb' # shortcut to the first method.
Though if you were really clever I suppose you could figure out how to
override the default rubygem behavior to do this, always
Speed difference example on linux:
$ time ruby examples/require_rubygems.rb
real 0m0.086s
user 0m0.077s
sys 0m0.008s
$ time ruby examples/require_fast_start.rb
real 0m0.026s
user 0m0.016s
sys 0m0.008s
So better but not "such a big deal" as it is on windows boxes (where it
can use up to 50% of script time). Also note that that's on warm
start--cold start might show higher differences. And it's still a 4x
speedup
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).
Thanks!
-=r
[1]
http://rubyforge.org/tracker/index.php?func=detail&aid=21288&group_id=126&atid=578