fast_require 0.0.0 → 0.3.3

Sign up to get free protection for your applications and to get access to all the features.
data/README CHANGED
@@ -0,0 +1,22 @@
1
+ A little utility to make
2
+ require 'xxx'
3
+
4
+ take much less time.
5
+
6
+ This is almost *necessary* for using 1.9.x on windows, and helps with 1.8, too.
7
+
8
+ If you've ever wondered why ruby feels slow...sometimes it's just the startup time, my friend. This helps with that.
9
+
10
+ Benchmarks:
11
+
12
+ loading
13
+
14
+ fast 0.34375 slow 3.203125
15
+
16
+
17
+ test rails app, running script/console "puts 333"
18
+
19
+ windows:
20
+ 1.9.1
21
+ without:
22
+
data/Rakefile CHANGED
@@ -3,9 +3,10 @@
3
3
  s.name = "fast_require"
4
4
  s.summary = "A tool designed to speedup library loading in Ruby by caching library locations"
5
5
  s.email = "rogerdpack@gmail.com"
6
- s.homepage = "http://github.com/rdp/fast_ruby_require"
6
+ s.homepage = "http://github.com/rdp/fast_require"
7
7
  s.authors = ["Roger Pack"]
8
8
  s.add_development_dependency 'rspec'
9
9
  s.add_development_dependency 'sane'
10
+ s.add_development_dependency 'ruby-prof'
10
11
  # s.add_dependency
11
12
  end
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.0
1
+ 0.3.3
@@ -0,0 +1,7 @@
1
+ require 'rubygems'
2
+ require '../lib/fast_require'
3
+ require 'stringio'
4
+ require 'redparse'
5
+ require 'ruby_parser'
6
+ RedParse
7
+ RubyParser
@@ -0,0 +1,6 @@
1
+ require 'rubygems'
2
+ require 'stringio'
3
+ require 'redparse'
4
+ require 'ruby_parser'
5
+ RedParse
6
+ RubyParser
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env ruby
2
+ require 'fast_require'
3
+ FastRequire.clear_all!
4
+ puts 'successfully cleared fast_require cache: (' + FastRequire.dir + ')'
@@ -1,13 +1,102 @@
1
1
  module FastRequire
2
+ $FAST_REQUIRE_DEBUG ||= false
3
+ def self.setup
4
+ @@dir = File.expand_path('~/.ruby_fast_require_cache')
2
5
 
3
- @@loc = File.expand_path('~/.ruby_fast_require_location')
4
- if File.exist? (@@loc)
5
- @@require_locs = Marshal.restore( File.open(@@loc, 'rb') {|f| f.read})
6
+ Dir.mkdir @@dir unless File.directory?(@@dir)
7
+ @@loc = @@dir + '/' + RUBY_VERSION + '-' + RUBY_PLATFORM + '-' + sanitize(File.expand_path($0).gsub(/[\/:]/, '_')) + sanitize(Dir.pwd)
8
+ end
9
+
10
+ def self.sanitize filename
11
+ filename.gsub(/[\/:]/, '_')
12
+ end
13
+
14
+ FastRequire.setup
15
+
16
+ if File.exist?(@@loc)
17
+ @@require_locs = Marshal.restore( File.open(@@loc, 'rb') {|f| f.read})
6
18
  else
7
19
  @@require_locs = {}
8
20
  end
9
21
  @@already_loaded = {}
10
- $LOADED_FEATURES.each{|loaded| @@already_loaded[loaded] = true}
22
+
23
+ # try to see where this file was loaded from, from $:
24
+ # partial_name might be abc.rb, or might be abc
25
+ # partial_name might be a full path, too
26
+ def self.guess_discover partial_name, add_dot_rb = false
27
+
28
+ # test for full path first
29
+ # unfortunately it has to be a full separate test
30
+ # for windoze sake, as drive letter could be different than slapping a '/' on the dir to test list...
31
+ tests = [partial_name]
32
+
33
+ if add_dot_rb
34
+ tests << partial_name + '.rb'
35
+ tests << partial_name + '.so'
36
+ end
37
+
38
+ tests.each{|b|
39
+ # assume that .rb.rb is...valid...
40
+ if File.file?(b) && ((b[-3..-1] == '.rb') || (b[-3..-1] == '.so'))
41
+ return File.expand_path(b)
42
+ end
43
+ }
44
+
45
+ for dir in $:
46
+ if File.file?(b = (dir + '/' + partial_name))
47
+ # make sure we require a file that has the right suffix...
48
+ if (b[-3..-1] == '.rb') || (b[-3..-1] == '.so')
49
+ return File.expand_path(b)
50
+ end
51
+
52
+ end
53
+ end
54
+
55
+ if add_dot_rb && (partial_name[-3..-1] != '.rb') && (partial_name[-3..-1] != '.so')
56
+ guess_discover(partial_name + '.rb') || guess_discover(partial_name + '.so')
57
+ else
58
+ nil
59
+ end
60
+ end
61
+
62
+ $LOADED_FEATURES.each{|already_loaded|
63
+ # in 1.8 they might be partial paths
64
+ # in 1.9, they might be non collapsed paths
65
+ # so we have to sanitize them here...
66
+ # XXXX File.exist? is a bit too loose, here...
67
+ if File.exist?(already_loaded)
68
+ key = File.expand_path(already_loaded)
69
+ else
70
+ key = FastRequire.guess_discover(already_loaded) || already_loaded
71
+ end
72
+ @@already_loaded[key] = true
73
+ }
74
+
75
+ @@already_loaded[File.expand_path(__FILE__)] = true # this file itself isn't in loaded features, yet, but very soon will be..
76
+ # special case--I hope...
77
+
78
+ # disallow re-requiring $0
79
+ @@require_locs[$0] = File.expand_path($0) # so when we run into it on a require, we will skip it...
80
+ @@already_loaded[File.expand_path($0)] = true
81
+
82
+
83
+ # XXXX within a very long depth to require fast_require,
84
+ # require 'a' => 'b' => 'c' => 'd' & fast_require
85
+ # then
86
+ # => 'b.rb'
87
+ # it works always
88
+
89
+ def self.already_loaded
90
+ @@already_loaded
91
+ end
92
+
93
+ def self.require_locs
94
+ @@require_locs
95
+ end
96
+
97
+ def self.dir
98
+ @@dir
99
+ end
11
100
 
12
101
  at_exit {
13
102
  FastRequire.save
@@ -17,47 +106,95 @@ module FastRequire
17
106
  File.open(@@loc, 'wb'){|f| f.write Marshal.dump(@@require_locs)}
18
107
  end
19
108
 
20
- def self.clear!
109
+ def self.clear_all!
21
110
  require 'fileutils'
22
- FileUtils.rm @@loc if File.exist? @@loc
111
+ FileUtils.rm_rf @@dir if File.exist? @@dir
23
112
  @@require_locs.clear
113
+ setup
24
114
  end
25
115
 
26
116
  def require_cached lib
27
- if a = @@require_locs[lib]
28
- return if @@already_loaded[a]
29
- @@already_loaded[a] = true
30
- if a =~ /.so$/
31
- puts 'doing original require on full path' if $DEBUG
32
- original_non_cached_require a # not much we can do there...too bad...
117
+ lib = lib.to_s unless lib.is_a?(String) # might not be zactly 1.9 compat...
118
+ if known_loc = @@require_locs[lib]
119
+ return false if @@already_loaded[known_loc]
120
+ @@already_loaded[known_loc] = true
121
+ if known_loc =~ /.so$/
122
+ puts 'doing original_non_cached_require on .so full path ' + known_loc if $FAST_REQUIRE_DEBUG
123
+ original_non_cached_require known_loc # not much we can do there...too bad...
33
124
  else
34
- puts 'doing eval on ' + lib + '=>' + a if $DEBUG
35
- eval(File.open(a, 'rb') {|f| f.read}, TOPLEVEL_BINDING, a) # note the b here--this means it's reading .rb files as binary, which *typically* works--if it breaks re-save the offending file in binary mode...
36
- $LOADED_FEATURES << a
37
- end
125
+ puts 'doing eval on ' + lib + '=>' + known_loc if $FAST_REQUIRE_DEBUG
126
+ $LOADED_FEATURES << known_loc # *must*
127
+ return eval(File.open(known_loc, 'rb') {|f| f.read}, TOPLEVEL_BINDING, known_loc) || true # note the b here--this means it's reading .rb files as binary, which *typically* works--if it breaks re-save the offending file in binary mode, or file an issue on the tracker...
128
+ end
38
129
  else
130
+ # we don't know the location--let Ruby's original require do the heavy lifting for us here
39
131
  old = $LOADED_FEATURES.dup
40
132
  if(original_non_cached_require lib)
133
+ # debugger might land here the first time you run a script and it doesn't have a require
134
+ # cached yet...
41
135
  new = $LOADED_FEATURES - old
42
- @@require_locs[lib] = new.last
43
- puts 'found new loc:' + lib + '=>' + @@require_locs[lib] if $DEBUG
44
- @@already_loaded[@@require_locs[lib]] = true
45
- end# how could this fail, though...
136
+ found = new.last
137
+
138
+ # incredibly, in 1.8.6, this doesn't always get set to a full path
139
+ if RUBY_VERSION < '1.9'
140
+ if !File.file?(found)
141
+ # discover the full path.
142
+ dir = $:.find{|path| File.file?(path + '/' + found)}
143
+ found = dir + '/' + found
144
+ end
145
+ found = File.expand_path(found);
146
+ end
147
+ puts 'found new loc:' + lib + '=>' + found if $FAST_REQUIRE_DEBUG
148
+ @@require_locs[lib] = found
149
+ @@already_loaded[found] = true
150
+ return true
151
+ else
152
+ puts 'already loaded, apparently' + lib if $FAST_REQUIRE_DEBUG
153
+ # this probably was something like
154
+ # the first pass was require 'regdeferred'
155
+ # now it's a different require 'regdeferred.rb'
156
+ # which fails (or vice versa)
157
+ # so figure out why
158
+ # calc location, expand, map back
159
+ where_found = FastRequire.guess_discover(lib, true)
160
+ if where_found
161
+ puts 'inferred ghost loc:' + lib + '=>' + where_found if $FAST_REQUIRE_DEBUG
162
+ @@require_locs[lib] = where_found
163
+ # unfortunately if it's our first pass
164
+ # and we are in the middle of a "real" require
165
+ # that is circular
166
+ # then $LOADED_FEATURES or (AFAIK) nothing will have been set
167
+ # for us to be able to assert that
168
+ # so...I think we'll end up
169
+ # just fudging for a bit
170
+ # raise 'not found' unless @@already_loaded[where_found] # should have already been set...I think...
171
+ else
172
+ if $FAST_REQUIRE_DEBUG
173
+ # happens for enumerator XXXX
174
+ puts 'unable to infer' + lib + ' in ' if $FAST_REQUIRE_DEBUG
175
+ end
176
+ end
177
+ return false # XXXX test all these return values
178
+ end
46
179
  end
47
-
180
+ end
181
+
182
+ def self.resetup!
183
+ eval "module ::Kernel; alias :require :require_cached; end"
48
184
  end
49
185
  end
50
186
 
51
187
  module Kernel
52
-
188
+
53
189
  if(defined?(@already_using_fast_require))
54
- raise 'cant require it twice...'
190
+ raise 'twice not allowed...'
191
+ # *shouldn't* get here...unless I'm wrong...
55
192
  else
56
193
  @already_using_fast_require = true
194
+ include FastRequire
195
+ # overwrite old require...
196
+ alias :original_non_cached_require :require
197
+ FastRequire.resetup!
57
198
  end
58
-
59
- include FastRequire
60
- # overwrite require...
61
- alias :original_non_cached_require :require
62
- alias :require :require_cached
63
- end
199
+
200
+ end
@@ -0,0 +1,5 @@
1
+ Gem.post_install { |gem_installer_instance|
2
+ require 'fast_require'
3
+ FastRequire.clear_all!
4
+ puts 'cleared fast_require caches due to new gem install...'
5
+ }
@@ -0,0 +1,4 @@
1
+ $FAST_REQUIRE_DEBUG = 1
2
+ a = File.dirname(File.expand_path(__FILE__)) + '/../../lib/fast_require.rb'
3
+ load a
4
+ load a
@@ -1,6 +1,4 @@
1
- puts 'in b.rb'
2
- if defined?($b)
3
- $b += 1
4
- else
5
- $b = 1
6
- end
1
+ if defined?($b) && $b > 0
2
+ raise 'cannot require b twice'
3
+ end
4
+ $b = 1
@@ -0,0 +1 @@
1
+ require 'fast_require'
@@ -0,0 +1 @@
1
+ require 'fast_require'
@@ -1,3 +1,4 @@
1
+ require 'rubygems'
1
2
  require File.dirname(__FILE__) + "/../../lib/fast_require.rb"
2
3
  require 'spec/autorun'
3
- Spec
4
+ a = Spec
@@ -0,0 +1,10 @@
1
+ require '../lib/fast_require.rb'
2
+ require 'rubygems'
3
+ Gem::Specification
4
+
5
+ #require '_dbg'
6
+ raise if FastRequire.already_loaded.to_a.flatten.grep(/files\/b.rb/).length > 0
7
+ require 'files/b.rb'
8
+ raise if(require 'files/b.rb')
9
+ raise unless FastRequire.already_loaded.to_a.flatten.grep(/files\/b.rb/).length > 0
10
+ #raise 'I dont trust this'
@@ -0,0 +1,9 @@
1
+ require 'rubygems'
2
+ Gem::Specification
3
+
4
+ require '../lib/fast_require.rb'
5
+
6
+ raise if FastRequire.already_loaded.to_a.flatten.grep(/files\/b.rb/).length > 0
7
+ require 'files/b.rb'
8
+ raise if(require 'files/b.rb')
9
+ raise unless FastRequire.already_loaded.to_a.flatten.grep(/files\/b.rb/).length > 0
@@ -0,0 +1,5 @@
1
+ require 'rubygems'
2
+ require 'ruby-debug'
3
+ require File.dirname(File.expand_path(__FILE__)) + '/../../lib/fast_require.rb'
4
+ require 'stringio'
5
+ require 'redparse'
File without changes
@@ -0,0 +1,6 @@
1
+ require File.dirname(File.expand_path(__FILE__)) + '/../../lib/fast_require.rb'
2
+ raise if (require File.dirname(File.expand_path(__FILE__)) + '/../../lib/fast_require.rb') # another test, why not? :)
3
+ paths = [File.expand_path('b.rb'), File.expand_path('b')]
4
+ paths.each{|p| require p}
5
+ paths.each{|p| raise unless FastRequire.require_locs.keys.include?(p)}
6
+
@@ -0,0 +1,6 @@
1
+ $:.unshift 'bin'
2
+ require File.dirname(File.expand_path(__FILE__)) + '/../../lib/fast_require.rb'
3
+ require 'non_dot_rb.rb' # succeed
4
+ require 'non_dot_rb' # fails (well, returns false), we think it succeeds, but it in the wrong place, so when we run the second time, it loads the wrong file
5
+
6
+ # unless my gem is working right
@@ -0,0 +1,6 @@
1
+ require File.dirname(File.expand_path(__FILE__)) + '/../../lib/fast_require.rb'
2
+ raise if (require File.dirname(File.expand_path(__FILE__)) + '/../../lib/fast_require.rb') # another test, why not? :)
3
+ require 'b.rb'
4
+ require 'b'
5
+ raise unless FastRequire.require_locs.keys.include?('b.rb') && FastRequire.require_locs.keys.include?('b')
6
+
@@ -0,0 +1,7 @@
1
+ require '../lib/fast_require.rb'
2
+ puts $0
3
+ raise if $already_here
4
+ $already_here = true
5
+ #require '_dbg'
6
+ 3
7
+ require $0
@@ -1,3 +1,3 @@
1
1
  require 'rubygems'
2
2
  require 'spec/autorun'
3
- Spec
3
+ a = Spec
@@ -1,95 +1,150 @@
1
- require 'faster_rubygems' if RUBY_VERSION < '1.9'
2
- require_relative '../lib/fast_require'
1
+ # $FAST_REQUIRE_DEBUG
2
+ require 'rubygems' if RUBY_VERSION < '1.9'
3
3
  require 'sane'
4
4
  require 'spec/autorun'
5
5
  require 'benchmark'
6
- require 'spec/adapters/mock_frameworks/rspec'
7
- #require 'ruby-debug'
8
6
 
9
- #assert !defined?(FastRequire) # so that we can loadup our unit tests sanely, using the old way LOL.
10
7
  require_relative '../lib/fast_require'
11
8
 
12
9
  describe "faster requires" do
13
10
 
11
+ before do
12
+ FastRequire.clear_all!
13
+ @old_length = $LOADED_FEATURES.length
14
+ $b = 0
15
+ @ruby = OS.ruby_bin + " "
16
+ end
17
+
14
18
  def with_file(filename = 'test')
15
19
  FileUtils.touch filename + '.rb'
16
20
  yield
17
21
  FileUtils.rm filename + '.rb'
18
22
  end
19
23
 
20
- it "should be able to go one deep" do
24
+ it "should be able to do a single require" do
25
+ old = $LOADED_FEATURES.dup
21
26
  Dir.chdir('files') do
22
- assert require 'c'
27
+ 3
28
+ #require '_dbg'
29
+ 3
30
+ assert require('c')
23
31
  assert !(require 'c')
24
32
  end
33
+ new = $LOADED_FEATURES - old
34
+ raise new.inspect if new.length > 1
25
35
  end
26
36
 
27
- it "should be able to go two deep, and once only" do
37
+ it "should be able to go two sub-requires deep appropriately" do
28
38
  Dir.chdir('files') do
29
- assert(require 'a_requires_b')
39
+ assert(require('a_requires_b'))
30
40
  assert !(require 'a_requires_b')
31
41
  assert !(require 'a_requires_b')
32
42
  $b.should == 1
33
43
  end
34
44
  end
35
-
45
+
36
46
  it "should be faster" do
37
47
  Dir.chdir('files') do
38
- #slow = Benchmark.realtime { system("#{OS.ruby_bin} slow.rb")}
39
- #Benchmark.realtime { system("#{OS.ruby_bin} fast.rb")} # warmup
40
- #fast = Benchmark.realtime { system("#{OS.ruby_bin} fast.rb")}
41
- #pps 'fast', fast, 'slow', slow
42
- #assert fast*2 < slow
48
+ slow = Benchmark.realtime { assert system("#{OS.ruby_bin} slow.rb")}
49
+ Benchmark.realtime { assert system("#{OS.ruby_bin} fast.rb")} # warmup
50
+ fast = Benchmark.realtime { assert system("#{OS.ruby_bin} fast.rb")}
51
+ pps 'fast', fast, 'slow', slow
52
+ assert fast < slow
43
53
  end
44
54
  end
45
-
46
- it "should not save if it hasn't changed"
47
- it "should cache when requires have already been done instead of calling require on them again"
48
- it "should know which requires are currently active and avoid calling require on them again"
49
-
50
- it "should have different based on $0"
51
-
52
-
53
- it "should do two of the same requires" do
54
- with_file('test') do
55
- assert(require 'test')
56
- assert(!(require 'test'))
57
- end
58
- end
59
-
60
- before do # each
61
- #FastRequire.clear!
62
- end
63
-
64
-
65
- it "should require files still" do
66
- with_file('file1') { require 'file1'}
55
+
56
+ it "should work with large complex gem" do
57
+ Dir.chdir('files') do
58
+ assert(system("#{OS.ruby_bin} large.rb"))
59
+ assert(system("#{OS.ruby_bin} large.rb"))
60
+ assert(system("#{OS.ruby_bin} large.rb"))
61
+ end
67
62
  end
68
63
 
69
- it "should require .so files still" do
64
+ it "should not re-save the cache file if it hasn't changed [?]"
65
+
66
+ it "should require .so files still, and only load them once" do
70
67
  # ruby-prof gem
71
- 2.times { require 'ruby_prof' } # .so
68
+ 2.times { require 'ruby_prof'; RubyProf } # .so
69
+ assert $LOADED_FEATURES.length == (@old_length + 1)
72
70
  end
73
71
 
74
- it "should add them to $LOADED_FEATURES" do
75
- with_file('file2') {require 'file2'}
72
+ it "should add requires to $LOADED_FEATURES" do
73
+ with_file('file2') {require 'file2'}
76
74
  assert ($LOADED_FEATURES.grep(/file2.rb/)).length > 0
75
+ assert $LOADED_FEATURES.length == (@old_length + 1)
77
76
  end
78
77
 
79
- it "should work with and without rubygems, esp. in 1.8" do
80
- # run these tests in 1.8...hmm...
81
- # maybe with and
82
- end
83
-
84
- it "should have a faster require method--faster, my friend, faster!"
85
-
86
- it "should save a file" do
87
- #FastRequire.clear!
88
- loc = File.expand_path('~/.ruby_fast_require_location')
89
- assert !File.exist?(loc)
78
+ it "should save a file as a cache in a dir" do
79
+ assert Dir[FastRequire.dir + '/*'].length == 0 # all clear
90
80
  FastRequire.save
91
- assert File.exist?(loc)
81
+ assert Dir[FastRequire.dir + '/*'].length > 0
92
82
  end
93
-
94
- it "should override the gem method"
95
- end
83
+
84
+ it "should have different caches based on the file being run, and Dir.pwd" do
85
+ # that wouldn't help much at all for ruby-prof runs, but...we do what we can
86
+ assert Dir[FastRequire.dir + '/*'].length == 0 # all clear
87
+ Dir.chdir('files') do
88
+ assert system("ruby -I../../lib d.rb")
89
+ assert system("ruby -I../../lib e.rb")
90
+ assert system("ruby -C.. -I../lib files/e.rb")
91
+ end
92
+ assert Dir[FastRequire.dir + '/*'].length == 3
93
+ assert Dir[FastRequire.dir + '/*spec_files_d*'].length == 1 # use full path
94
+ assert Dir[FastRequire.dir + '/*spec_files_e*'].length == 2 # different dirs
95
+ end
96
+
97
+ context "should work with ascii files well" do # most are binary, so...low prio
98
+ it "could cache the converted file, if that speeds things up"
99
+ end
100
+
101
+ private
102
+ def ruby filename
103
+ assert system(@ruby + " " + filename)
104
+ end
105
+
106
+ it "should override rubygems' require if rubygems is loaded after the fact...maybe by hooking to Gem::const_defined or something" do
107
+ ruby "files/gem_after.rb"
108
+ end
109
+
110
+ it "should override rubygems' require if rubygems is loaded before the fact" do
111
+ ruby "files/gem_before.rb"
112
+ end
113
+
114
+ it "should throw if you require it twice" do
115
+ Dir.chdir('files') do
116
+ assert !system(@ruby + 'attempt_double_load.rb')
117
+ end
118
+ end
119
+
120
+ it "should force require 'abc' to not load file called exactly abc" do
121
+ Dir.chdir('files') do
122
+ ruby 'require_non_dot_rb_fails.rb'
123
+ ruby 'require_non_dot_rb_fails.rb' # should succeed
124
+ end
125
+ end
126
+
127
+ it "should be able to handle full paths" do
128
+ Dir.chdir('files') do
129
+ ruby 'require_full_path.rb'
130
+ ruby 'require_full_path.rb'
131
+ end
132
+ end
133
+
134
+ it "should handle Pathname too" do
135
+ require 'pathname'
136
+ require Pathname.new('spec.fast_require.rb')
137
+ end
138
+
139
+ it "should work well with rubygems for gem libs (installed), themselves"
140
+
141
+ it "should disallow a file requiring itself" do
142
+ ruby 'files/requires_itself.rb'
143
+ ruby 'files/requires_itself.rb'
144
+ end
145
+
146
+
147
+
148
+
149
+
150
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fast_require
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.0
4
+ version: 0.3.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Roger Pack
@@ -9,8 +9,8 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2010-01-18 00:00:00 -07:00
13
- default_executable:
12
+ date: 2010-01-27 00:00:00 -07:00
13
+ default_executable: fast_require
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rspec
@@ -32,10 +32,20 @@ dependencies:
32
32
  - !ruby/object:Gem::Version
33
33
  version: "0"
34
34
  version:
35
+ - !ruby/object:Gem::Dependency
36
+ name: ruby-prof
37
+ type: :development
38
+ version_requirement:
39
+ version_requirements: !ruby/object:Gem::Requirement
40
+ requirements:
41
+ - - ">="
42
+ - !ruby/object:Gem::Version
43
+ version: "0"
44
+ version:
35
45
  description:
36
46
  email: rogerdpack@gmail.com
37
- executables: []
38
-
47
+ executables:
48
+ - fast_require
39
49
  extensions: []
40
50
 
41
51
  extra_rdoc_files:
@@ -43,17 +53,28 @@ extra_rdoc_files:
43
53
  files:
44
54
  - README
45
55
  - Rakefile
46
- - TODO.LIST
47
56
  - VERSION
57
+ - benchmark/benchmark.rb
58
+ - benchmark/benchmark_slow.rb
59
+ - bin/fast_require
48
60
  - lib/fast_require.rb
61
+ - lib/rubygems_plugin.rb
49
62
  - spec/files/a_requires_b.rb
63
+ - spec/files/attempt_double_load.rb
50
64
  - spec/files/b.rb
51
65
  - spec/files/c.rb
66
+ - spec/files/d.rb
67
+ - spec/files/e.rb
52
68
  - spec/files/fast.rb
69
+ - spec/files/gem_after.rb
70
+ - spec/files/large.rb
71
+ - spec/files/non_dot_rb.rb
72
+ - spec/files/require_full_path.rb
73
+ - spec/files/require_twice_in_dir_pwd.rb
53
74
  - spec/files/slow.rb
54
75
  - spec/spec.fast_require.rb
55
76
  has_rdoc: true
56
- homepage: http://github.com/rdp/fast_ruby_require
77
+ homepage: http://github.com/rdp/fast_require
57
78
  licenses: []
58
79
 
59
80
  post_install_message:
@@ -81,9 +102,20 @@ signing_key:
81
102
  specification_version: 3
82
103
  summary: A tool designed to speedup library loading in Ruby by caching library locations
83
104
  test_files:
105
+ - spec/files/attempt_double_load.rb
84
106
  - spec/files/a_requires_b.rb
85
107
  - spec/files/b.rb
86
108
  - spec/files/c.rb
109
+ - spec/files/d.rb
110
+ - spec/files/e.rb
87
111
  - spec/files/fast.rb
112
+ - spec/files/gem_after.rb
113
+ - spec/files/gem_before.rb
114
+ - spec/files/large.rb
115
+ - spec/files/non_dot_rb.rb
116
+ - spec/files/requires_itself.rb
117
+ - spec/files/require_full_path.rb
118
+ - spec/files/require_non_dot_rb_fails.rb
119
+ - spec/files/require_twice_in_dir_pwd.rb
88
120
  - spec/files/slow.rb
89
121
  - spec/spec.fast_require.rb
data/TODO.LIST DELETED
@@ -1,8 +0,0 @@
1
- irb(main):001:0> $LOADED_FEATURES << 'abc.rb'
2
- => ["enumerator.so", "E:/installs/ruby191p376/lib/ruby/1.9.1/i386-mingw32/enc/encdb.so", "E:/installs/ruby191p376/lib/ruby/1.9.1/i386-mingw32/enc/trans/transdb.so", "E:/installs/ruby191p376/lib/ruby/1.9.1/i386-mingw32/enc/iso_8859_1.so", "E:/installs/ruby191p376/lib/ruby/1.9.1/rubygems.rb", "E:/installs/ruby191p376/lib/ruby/gems/1.9.1/gems/faster_rubygems-0.1.0/lib/faster_rubygems.rb", "E:/installs/ruby191p376/lib/ruby/gems/1.9.1/gems/faster_rubygems-0.1.0/lib/ubygemsf.rb", "E:/installs/ruby191p376/lib/ruby/1.9.1/i386-mingw32/rbconfig.rb", "E:/installs/ruby191p376/lib/ruby/gems/1.9.1/gems/backtracer-0.7.2/lib/shared.rb", "E:/installs/ruby191p376/lib/ruby/gems/1.9.1/gems/backtracer-0.7.2/lib/backtracer.rb", "E:/installs/ruby191p376/lib/ruby/1.9.1/e2mmap.rb", "E:/installs/ruby191p376/lib/ruby/1.9.1/irb/init.rb", "E:/installs/ruby191p376/lib/ruby/1.9.1/irb/workspace.rb", "E:/installs/ruby191p376/lib/ruby/1.9.1/irb/context.rb", "E:/installs/ruby191p376/lib/ruby/1.9.1/irb/extend-command.rb", "E:/installs/ruby191p376/lib/ruby/1.9.1/irb/output-method.rb", "E:/installs/ruby191p376/lib/ruby/1.9.1/irb/notifier.rb", "E:/installs/ruby191p376/lib/ruby/1.9.1/irb/slex.rb", "E:/installs/ruby191p376/lib/ruby/1.9.1/irb/ruby-token.rb", "E:/installs/ruby191p376/lib/ruby/1.9.1/irb/ruby-lex.rb", "E:/installs/ruby191p376/lib/ruby/1.9.1/irb/src_encoding.rb", "E:/installs/ruby191p376/lib/ruby/1.9.1/irb/magic-file.rb", "E:/installs/ruby191p376/lib/ruby/1.9.1/i386-mingw32/enc/euc_jp.so", "E:/installs/ruby191p376/lib/ruby/1.9.1/i386-mingw32/enc/shift_jis.so", "E:/installs/ruby191p376/lib/ruby/1.9.1/i386-mingw32/etc.so", "E:/installs/ruby191p376/lib/ruby/1.9.1/i386-mingw32/dl.so", "E:/installs/ruby191p376/lib/ruby/site_ruby/1.9.1/rbreadline.rb", "E:/installs/ruby191p376/lib/ruby/site_ruby/1.9.1/readline.rb", "E:/installs/ruby191p376/lib/ruby/1.9.1/irb/input-method.rb", "E:/installs/ruby191p376/lib/ruby/1.9.1/irb/locale.rb", "E:/installs/ruby191p376/lib/ruby/1.9.1/irb.rb", "abc.rb"]
3
- irb(main):002:0> require 'abc'
4
- => false
5
-
6
- this could be optimized more for 1.9
7
-
8
- Also, could loaded_features be made into a hash for much faster comparison?