Giter Site home page Giter Site logo

faster_rubygems's Introduction

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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.