Sha256: 9aa3a4a46663b7ab83cd2bab775413ec73fc70daccdc376fd6cec4348111d16e

Contents?: true

Size: 1.83 KB

Versions: 1

Compression:

Stored size: 1.83 KB

Contents

A little utility to make

require 'xxx'

take much less time.  As in much less.  Well, on windows at least.

Well, mostly on windows--on linux it's a speedup of only 0.41 to 0.45s, or so. [1]

If you've ever wondered why ruby feels slow on doze...sometimes it's just the startup time.  This helps.

Benchmarks:

loading a spec file:

  1.9.1   
    without 3.20s
    with 0.34s (10x improvement)

  1.8.6
    without 3.6s
    with 1.25s
    

rails app, running script/console "puts 333"

 1.9.1
   without:
      20s
    with:
      10s
 
 1.8.6 
   without:
       9s
   with:
       6s
       
running "rake -T"

 1.9.1
   without: 3.75s
   with: 1.5s       

 1.8.6
   without: 1.37s
   with:    1.25s
   
Note: in reality what we should do is fix core so that it doesn't have such awful I/O time in windows.  There may be some gross inefficiency in there.  For now, this is a work-around.
   
[1] A sister project to this one, faster_gem_script, can make ruby scripts in linux run faster by 0.1s :) http://github.com/rdp/faster_gem_script
(in windows it's a much higher gain).  Eventually they'll be combined into one "gem optimizer" gem.

== How to use in Rails ==

You can either install the gem, then add a

require 'rubygems'
require 'faster_require'


in your config/environment.rb, or (the best way is as follows):

Unpack it somewhere, like lib
$ cd my_rails_app/lib
$ gem unpack faster_require

Now add this line to your config/environment.rb:

require File.dirname(__FILE__) + "/../lib/faster_require-0.7.0/lib/faster_require" # faster speeds all around...

*before* this other (existing) line:

require File.join(File.dirname(__FILE__), 'boot')

Now it will speedup loading rubygems and everything. Happiness.

Any problems report back: https://github.com/rdp/faster_require

Enjoy.

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
faster_require-0.7.0 README