ks_faster_require 0.9.4
Sign up to get free protection for your applications and to get access to all the features.
- data/ChangeLog +23 -0
- data/LICENSE +3 -0
- data/README +164 -0
- data/Rakefile +26 -0
- data/TODO +7 -0
- data/VERSION +1 -0
- data/benchmark/benchmark.rb +7 -0
- data/benchmark/benchmark_slow.rb +6 -0
- data/bin/faster_require +4 -0
- data/lib/faster_require.rb +365 -0
- data/lib/rubygems_plugin.rb +8 -0
- data/spec/files/a_requires_b.rb +1 -0
- data/spec/files/active_support_no_double_load.rb +15 -0
- data/spec/files/attempt_double_load.rb +6 -0
- data/spec/files/attempt_double_load_wrong_version.rb +5 -0
- data/spec/files/b.rb +4 -0
- data/spec/files/c.rb +5 -0
- data/spec/files/clear.bat +1 -0
- data/spec/files/d.rb +1 -0
- data/spec/files/e.rb +1 -0
- data/spec/files/fast.rb +4 -0
- data/spec/files/fast2.rb +4 -0
- data/spec/files/file_that_sets_ignore_pwd_flag.rb +2 -0
- data/spec/files/gem_after.rb +10 -0
- data/spec/files/gem_before.rb +10 -0
- data/spec/files/large.rb +4 -0
- data/spec/files/load_various_gems.rb +11 -0
- data/spec/files/load_various_gems2.rb +6 -0
- data/spec/files/non_dot_rb.rb +0 -0
- data/spec/files/regin_gem.rb +6 -0
- data/spec/files/require_facets.rb +3 -0
- data/spec/files/require_full_path.rb +6 -0
- data/spec/files/require_non_dot_rb_fails.rb +7 -0
- data/spec/files/require_twice_in_dir_pwd.rb +6 -0
- data/spec/files/requires_itself.rb +4 -0
- data/spec/files/should_put_modules_in_right_place.rb +5 -0
- data/spec/files/slow.rb +3 -0
- data/spec/files/socket_load.rb +10 -0
- data/spec/files/time_just_loading_rubygems.rb +2 -0
- data/spec/spec.fast_require.rb +210 -0
- data/todo +7 -0
- metadata +252 -0
data/ChangeLog
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
0.9.4: work with some UTF-8 encoded .rb files...which is the default now so hopefully ok.
|
2
|
+
1.9.x compat. only [ping me if you want this changed]
|
3
|
+
|
4
|
+
0.9.3:
|
5
|
+
possibly an execsjs fix?
|
6
|
+
|
7
|
+
0.9.1: work with rails 3.0.7 through a kludgey way...
|
8
|
+
|
9
|
+
0.9.0: refactors, bug fix for poor file, can autoload disregarding dir now
|
10
|
+
|
11
|
+
0.8.1: work with 1.8.6 again
|
12
|
+
|
13
|
+
0.8.0: work with 1.9.x again
|
14
|
+
|
15
|
+
0.7.5: unique hash now, for the cache file [hopefuly]
|
16
|
+
|
17
|
+
0.7.4: allow double loading, for rails apps and gems to load it.
|
18
|
+
|
19
|
+
0.7.3: work with 1.9 require_relative
|
20
|
+
|
21
|
+
0.7.1: Accomodate for non HOME environment variable [what the..]
|
22
|
+
|
23
|
+
0.7.0: now it works with autoload finally [and thus hopefully rails]
|
data/LICENSE
ADDED
data/README
ADDED
@@ -0,0 +1,164 @@
|
|
1
|
+
A little utility to make load time faster, especially by making
|
2
|
+
|
3
|
+
require 'xxx'
|
4
|
+
|
5
|
+
take much less time. As in much less. Well, on windows at least it's faster.
|
6
|
+
It speeds up how long it takes things to load in windows, like rails apps.
|
7
|
+
|
8
|
+
Well, mostly on windows--on linux it's a speedup of only 0.41 to 0.45s, or so. [1]
|
9
|
+
|
10
|
+
If you've ever wondered why ruby feels slow on doze...sometimes it's just the startup time. This really helps.
|
11
|
+
|
12
|
+
Benchmarks:
|
13
|
+
|
14
|
+
loading a (blank) rspec file:
|
15
|
+
|
16
|
+
1.9.1
|
17
|
+
without 3.20s
|
18
|
+
with 0.34s (10x improvement)
|
19
|
+
|
20
|
+
1.8.6
|
21
|
+
without 3.6s
|
22
|
+
with 1.25s
|
23
|
+
|
24
|
+
|
25
|
+
rails app, running a unit test
|
26
|
+
|
27
|
+
1.8.6
|
28
|
+
without:
|
29
|
+
23s
|
30
|
+
with:
|
31
|
+
14s
|
32
|
+
|
33
|
+
rails app, running $ script/console "puts 333"
|
34
|
+
|
35
|
+
1.9.1
|
36
|
+
without:
|
37
|
+
20s
|
38
|
+
with:
|
39
|
+
10s
|
40
|
+
|
41
|
+
1.8.6
|
42
|
+
without:
|
43
|
+
9s
|
44
|
+
with:
|
45
|
+
6s
|
46
|
+
|
47
|
+
running "rake -T" somewhere
|
48
|
+
|
49
|
+
1.9.1
|
50
|
+
without: 3.75s
|
51
|
+
with: 1.5s
|
52
|
+
|
53
|
+
1.8.6
|
54
|
+
without: 1.37s
|
55
|
+
with: 1.25s
|
56
|
+
|
57
|
+
Note: in reality what we should do is fix core so that it doesn't have such awful load time in windows. There may be some inefficiency in there. For now, this is a work-around that helps.
|
58
|
+
|
59
|
+
Also it helps with SSD's even, on windows, as it avoids some cpu used at require time, at least for 1.9.x
|
60
|
+
|
61
|
+
NB that installing newer versions of rubygems also seems to speedup start time (see below for how you can use them both, however, which is the best way).
|
62
|
+
In fact, 1.8.7 with newer rubygems and only very few requires seems pretty fast, even without faster_require.
|
63
|
+
Once you have any number of requires, though, you'll want faster_require.
|
64
|
+
Rails needs it, and 1.9 still needs it, though, even with a newer rubygems,
|
65
|
+
so you'll get some benefit from this library always--but don't take my word for it,
|
66
|
+
profile it and find out for yourself.
|
67
|
+
|
68
|
+
== How to use ==
|
69
|
+
|
70
|
+
The naive we is to use it by installing the gem, then adding
|
71
|
+
|
72
|
+
require 'rubygems'
|
73
|
+
require 'faster_require'
|
74
|
+
|
75
|
+
to the top of some (your initial) script.
|
76
|
+
|
77
|
+
However this doesn't speedup the loading of rubygems itself (XXX is much speedup?), so you can do this to get best performance:
|
78
|
+
|
79
|
+
G:>gem which faster_require
|
80
|
+
C:/installs/Ruby187/lib/ruby/gems/1.8/gems/faster_require-0.7.4/lib/faster_require.rb
|
81
|
+
|
82
|
+
now before doing require rubygems in your script, do this:
|
83
|
+
|
84
|
+
require 'C:/installs/Ruby187/lib/ruby/gems/1.8/gems/faster_require-0.7.4/lib/faster_require.rb'
|
85
|
+
|
86
|
+
Then rubygems' load will be cached too. Which is faster. Or see "installing globally" below.
|
87
|
+
|
88
|
+
== How to use in Rails ==
|
89
|
+
|
90
|
+
One way is to install the gem, then add a
|
91
|
+
|
92
|
+
require 'rubygems'
|
93
|
+
require 'faster_require'
|
94
|
+
|
95
|
+
in your config/environment.rb, or (the better way is as follows):
|
96
|
+
|
97
|
+
Unpack it somewhere, like lib
|
98
|
+
|
99
|
+
$ cd my_rails_app/lib
|
100
|
+
$ gem unpack faster_require
|
101
|
+
|
102
|
+
Now add this line to your config/environment.rb:
|
103
|
+
|
104
|
+
require File.dirname(__FILE__) + "/../lib/faster_require-0.7.0/lib/faster_require" # faster speeds all around...make sure to update it to whatever version number you fetched though.
|
105
|
+
|
106
|
+
add that *before* this other (pre-existing) line:
|
107
|
+
|
108
|
+
require File.join(File.dirname(__FILE__), 'boot')
|
109
|
+
|
110
|
+
Now faster_require will speedup loading rubygems and everything railsy. Happiness. (NB that setting it this will also run in production mode code, so be careful here, though it does work for me fine for production).
|
111
|
+
|
112
|
+
Ping me if it's still too slow.
|
113
|
+
|
114
|
+
== Clearing the cache ==
|
115
|
+
|
116
|
+
If you use bundler to change bundled gems, you'll want to run the command $ faster_require --clear-cache
|
117
|
+
so that it will pick up any new load paths. Also if you moves files around to new directories, you may want to do the same.
|
118
|
+
As you install any new gems, it should clear the paths automatically for you.
|
119
|
+
|
120
|
+
== How to use generally/globally ==
|
121
|
+
|
122
|
+
You can install it to be used "always" (well, for anything that loads rubygems, at least, which is most things, via something like the following):
|
123
|
+
|
124
|
+
$ gem which rubygems
|
125
|
+
d:/Ruby192/lib/ruby/site_ruby/1.9.1/rubygems.rb
|
126
|
+
|
127
|
+
$ gem which faster_require
|
128
|
+
d:/Ruby192/lib/ruby/gems/1.9.1/gems/faster_require-0.6.0/lib/faster_require.rb
|
129
|
+
|
130
|
+
Now edit the rubygems.rb file, and add a require line to the top of it of the faster_require file, like this:
|
131
|
+
require 'd:/Ruby192/lib/ruby/gems/1.9.1/gems/faster_require-0.6.0/lib/faster_require.rb'
|
132
|
+
|
133
|
+
at the top of rubygems.rb file
|
134
|
+
|
135
|
+
update the path to be your own, obviously. You'll also have to change that added line if
|
136
|
+
you ever install a newer version of faster_require gem, or if you update your version of rubygems,
|
137
|
+
as the rubygems.rb file will be wiped clean at that point.
|
138
|
+
|
139
|
+
This will cause everything to load faster.
|
140
|
+
|
141
|
+
== How to ignore PWD for faster_require ==
|
142
|
+
|
143
|
+
Faster_require also takes into consideration your Dir.pwd when you run it, for cacheing sake.
|
144
|
+
This means that if you run a ruby gem install script (like redcar's bin/redcar, for instance) and run it from different directories, it will always
|
145
|
+
be slow the first time you run it in each directory.
|
146
|
+
To make it be fast and basically disregard PWD, you can add global setting $faster_require_ignore_pwd_for_cache = true
|
147
|
+
and set it before requiring faster_require itself.
|
148
|
+
|
149
|
+
So now rubygems.rb at the top would look like
|
150
|
+
$faster_require_ignore_pwd_for_cache = true
|
151
|
+
require 'd:/Ruby192/lib/ruby/gems/1.9.1/gems/faster_require-0.6.0/lib/faster_require.rb'
|
152
|
+
|
153
|
+
And now your gem scripts will run fast regardless of where you run them from.
|
154
|
+
|
155
|
+
== See also ==
|
156
|
+
|
157
|
+
Spork can help speedup rails tests. It "should" work well when used in conjunction with faster_require, as well.
|
158
|
+
|
159
|
+
Also "The Code Shop" releases versions of ruby that have an optimized require method, which might make this library obsolete.
|
160
|
+
http://thecodeshop.github.com
|
161
|
+
https://groups.google.com/group/thecodeshop
|
162
|
+
http://itreallymatters.net/post/12897174267/speedup-ruby-1-9-3-on-windows#.T89_XtVYut0
|
163
|
+
|
164
|
+
Enjoy.
|
data/Rakefile
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
|
3
|
+
#NB that releasing with 1.9.x is ill advised...
|
4
|
+
|
5
|
+
require 'jeweler'
|
6
|
+
Jeweler::Tasks.new do |s|
|
7
|
+
s.name = "ks_faster_require"
|
8
|
+
s.summary = "Speed library loading in Ruby"
|
9
|
+
s.description = "Modified version of faster require to fix a UTF8 cygwin bug"
|
10
|
+
s.email = "karlstoney@gmail.com"
|
11
|
+
s.homepage = "https://github.com/Stono/faster_require"
|
12
|
+
s.authors = ["Roger Pack", "faisal", "Karl Stoney"]
|
13
|
+
s.add_development_dependency 'redparse'
|
14
|
+
s.add_development_dependency 'activesupport', '= 2.3.10'
|
15
|
+
s.add_development_dependency 'actionpack', '= 2.3.10'
|
16
|
+
s.add_development_dependency 'jeweler'
|
17
|
+
s.add_development_dependency 'rspec', '>= 2'
|
18
|
+
s.add_development_dependency 'sane'
|
19
|
+
s.add_development_dependency 'facets'
|
20
|
+
s.add_development_dependency 'ruby-prof'
|
21
|
+
s.add_development_dependency 'rack-mount', '=0.6.14'
|
22
|
+
s.add_development_dependency 'rack', '=1.2.2'
|
23
|
+
|
24
|
+
# ALSO INSTALL THIS! ->
|
25
|
+
# s.add_development_dependency 'ruby-debug' too... or ruby-debug19 pick your poison
|
26
|
+
end
|
data/TODO
ADDED
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.9.4
|
data/bin/faster_require
ADDED
@@ -0,0 +1,365 @@
|
|
1
|
+
# check for and avoid a double load...because we're afraid to load twice, since we override require et al
|
2
|
+
|
3
|
+
if(defined?($already_using_faster_require))
|
4
|
+
p 'warning: faster_require double load--expected?' if $FAST_REQUIRE_DEBUG
|
5
|
+
local_version = File.read(File.dirname(__FILE__) + "/../VERSION")
|
6
|
+
raise "mismatched faster_require versions! #{local_version} != #{FastRequire::VERSION}" unless local_version == FastRequire::VERSION
|
7
|
+
else
|
8
|
+
|
9
|
+
$already_using_faster_require = true
|
10
|
+
|
11
|
+
|
12
|
+
require 'rbconfig' # maybe could cache this one's loc, too? probably not...
|
13
|
+
|
14
|
+
module FastRequire
|
15
|
+
|
16
|
+
$FAST_REQUIRE_DEBUG ||= $DEBUG # can set this via $DEBUG, or on its own previously
|
17
|
+
VERSION = File.read(File.dirname(__FILE__) + "/../VERSION")
|
18
|
+
|
19
|
+
def self.sanitize filename
|
20
|
+
filename.gsub(/[\/:]/, '_')
|
21
|
+
end
|
22
|
+
|
23
|
+
if RUBY_VERSION >= '1.9.0'
|
24
|
+
# appears 1.9.x has inconsistent string hashes...so roll our own...
|
25
|
+
def self.string_array_cruddy_hash strings
|
26
|
+
# we only call this method once, so overflowing to a bignum is ok
|
27
|
+
hash = 1;
|
28
|
+
for string in strings
|
29
|
+
hash = hash * 31
|
30
|
+
string.each_byte{|b|
|
31
|
+
hash += b
|
32
|
+
}
|
33
|
+
end
|
34
|
+
hash # probably a Bignum (sigh)
|
35
|
+
end
|
36
|
+
|
37
|
+
else
|
38
|
+
|
39
|
+
def self.string_array_cruddy_hash strings
|
40
|
+
strings.hash
|
41
|
+
end
|
42
|
+
|
43
|
+
end
|
44
|
+
|
45
|
+
def self.setup
|
46
|
+
begin
|
47
|
+
@@dir = File.expand_path('~/.ruby_faster_require_cache')
|
48
|
+
rescue ArgumentError => e # couldn't find HOME environment or the like
|
49
|
+
whoami = `whoami`.strip
|
50
|
+
if File.directory?(home = "/home/#{whoami}")
|
51
|
+
@@dir = home + '/.ruby_faster_require_cache'
|
52
|
+
else
|
53
|
+
raise e.to_s + " and couldnt infer it from whoami"
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
unless File.directory?(@@dir)
|
58
|
+
Dir.mkdir @@dir
|
59
|
+
raise 'unable to create user dir for faster_require ' + @@dir unless File.directory?(@@dir)
|
60
|
+
end
|
61
|
+
|
62
|
+
config = RbConfig::CONFIG
|
63
|
+
|
64
|
+
# try to be a unique, but not too long, filename, for restrictions on filename length in doze
|
65
|
+
ruby_bin_name = config['bindir'] + config['ruby_install_name'] # needed if you have two rubies, same box, same ruby description [version, patch number]
|
66
|
+
parts = [File.basename($0), RUBY_PATCHLEVEL.to_s, RUBY_PLATFORM, RUBY_VERSION, RUBY_VERSION, File.expand_path(File.dirname($0)), ruby_bin_name]
|
67
|
+
unless defined?($faster_require_ignore_pwd_for_cache)
|
68
|
+
# add in Dir.pwd
|
69
|
+
parts << File.basename(Dir.pwd)
|
70
|
+
parts << Dir.pwd
|
71
|
+
else
|
72
|
+
p 'ignoring dirpwd for cached file location' if $FAST_REQUIRE_DEBUG
|
73
|
+
end
|
74
|
+
|
75
|
+
sanitized_parts = parts.map{|part| sanitize(part)}
|
76
|
+
|
77
|
+
full_parts_hash = string_array_cruddy_hash(parts).to_s
|
78
|
+
|
79
|
+
loc_name = (sanitized_parts.map{|part| part[0..5] + (part[-5..-1] || '')}).join('-') + '-' + full_parts_hash + '.marsh'
|
80
|
+
|
81
|
+
@@loc = @@dir + '/' + loc_name
|
82
|
+
|
83
|
+
if File.exist?(@@loc)
|
84
|
+
FastRequire.load @@loc
|
85
|
+
else
|
86
|
+
@@require_locs = {}
|
87
|
+
end
|
88
|
+
|
89
|
+
@@already_loaded = {}
|
90
|
+
|
91
|
+
$LOADED_FEATURES.each{|already_loaded|
|
92
|
+
# in 1.8 they might be partial paths
|
93
|
+
# in 1.9, they might be non collapsed paths
|
94
|
+
# so we have to sanitize them here...
|
95
|
+
# XXXX File.exist? is a bit too loose, here...
|
96
|
+
if File.exist?(already_loaded)
|
97
|
+
key = File.expand_path(already_loaded)
|
98
|
+
else
|
99
|
+
key = FastRequire.guess_discover(already_loaded) || already_loaded
|
100
|
+
end
|
101
|
+
@@already_loaded[key] = true
|
102
|
+
}
|
103
|
+
|
104
|
+
@@already_loaded[File.expand_path(__FILE__)] = true # this file itself isn't in loaded features, yet, but very soon will be..
|
105
|
+
# a special case--I hope...
|
106
|
+
|
107
|
+
# also disallow re-loading $0
|
108
|
+
@@require_locs[$0] = File.expand_path($0) # so when we run into $0 on a freak require, we will skip it...
|
109
|
+
@@already_loaded[File.expand_path($0)] = true
|
110
|
+
|
111
|
+
end
|
112
|
+
|
113
|
+
def self.load filename
|
114
|
+
cached_marshal_data = File.open(filename, 'rb') {|f| f.read}
|
115
|
+
begin
|
116
|
+
@@require_locs = Marshal.restore( cached_marshal_data )
|
117
|
+
rescue ArgumentError
|
118
|
+
@@require_locs= {}
|
119
|
+
end
|
120
|
+
end
|
121
|
+
|
122
|
+
|
123
|
+
# try to see where this file was loaded from, from $:
|
124
|
+
# partial_name might be abc.rb, or might be abc
|
125
|
+
# partial_name might be a full path, too
|
126
|
+
def self.guess_discover partial_name, add_dot_rb = false
|
127
|
+
|
128
|
+
# test for full path first
|
129
|
+
# unfortunately it has to be a full separate test
|
130
|
+
# for windoze sake, as drive letter could be different than slapping a '/' on the dir to test list...
|
131
|
+
tests = [partial_name]
|
132
|
+
|
133
|
+
if add_dot_rb
|
134
|
+
tests << partial_name + '.rb'
|
135
|
+
tests << partial_name + '.' + RbConfig::CONFIG['DLEXT']
|
136
|
+
end
|
137
|
+
|
138
|
+
tests.each{|b|
|
139
|
+
# assume that .rb.rb is...valid...?
|
140
|
+
if File.file?(b) && ((b[-3..-1] == '.rb') || (b[-3..-1] == '.' + RbConfig::CONFIG['DLEXT']))
|
141
|
+
return File.expand_path(b)
|
142
|
+
end
|
143
|
+
}
|
144
|
+
|
145
|
+
for dir in $:
|
146
|
+
if File.file?(b = (dir + '/' + partial_name))
|
147
|
+
# make sure we require a file that has the right suffix...
|
148
|
+
if (b[-3..-1] == '.rb') || (b[-3..-1] == '.' + RbConfig::CONFIG['DLEXT'])
|
149
|
+
return File.expand_path(b)
|
150
|
+
end
|
151
|
+
|
152
|
+
end
|
153
|
+
end
|
154
|
+
|
155
|
+
if add_dot_rb && (partial_name[-3..-1] != '.rb') && (partial_name[-3..-1] != '.' + RbConfig::CONFIG['DLEXT'])
|
156
|
+
guess_discover(partial_name + '.rb') || guess_discover(partial_name + '.')
|
157
|
+
else
|
158
|
+
nil
|
159
|
+
end
|
160
|
+
end
|
161
|
+
|
162
|
+
FastRequire.setup
|
163
|
+
|
164
|
+
def self.already_loaded
|
165
|
+
@@already_loaded
|
166
|
+
end
|
167
|
+
|
168
|
+
def self.require_locs
|
169
|
+
@@require_locs
|
170
|
+
end
|
171
|
+
|
172
|
+
def self.dir
|
173
|
+
@@dir
|
174
|
+
end
|
175
|
+
|
176
|
+
def self.loc
|
177
|
+
@@loc
|
178
|
+
end
|
179
|
+
|
180
|
+
at_exit {
|
181
|
+
FastRequire.default_save
|
182
|
+
}
|
183
|
+
|
184
|
+
def self.default_save
|
185
|
+
self.save @@loc
|
186
|
+
end
|
187
|
+
|
188
|
+
def self.save to_file
|
189
|
+
File.open(to_file, 'wb'){|f| f.write Marshal.dump(@@require_locs)}
|
190
|
+
end
|
191
|
+
|
192
|
+
# for testing use only, basically
|
193
|
+
def self.clear_all!
|
194
|
+
require 'fileutils'
|
195
|
+
success = false
|
196
|
+
if File.exist? @@dir
|
197
|
+
FileUtils.rm_rf @@dir
|
198
|
+
success = true
|
199
|
+
end
|
200
|
+
@@require_locs.clear
|
201
|
+
setup
|
202
|
+
success
|
203
|
+
end
|
204
|
+
|
205
|
+
private
|
206
|
+
def last_caller
|
207
|
+
caller[-2]
|
208
|
+
end
|
209
|
+
|
210
|
+
IN_PROCESS = []
|
211
|
+
ALL_IN_PROCESS = []
|
212
|
+
@@count = 0
|
213
|
+
|
214
|
+
public
|
215
|
+
|
216
|
+
def require_cached lib
|
217
|
+
lib = lib.to_s # might not be zactly 1.9 compat... to_path ??
|
218
|
+
ALL_IN_PROCESS << [lib, @@count += 1]
|
219
|
+
begin
|
220
|
+
p 'doing require ' + lib + ' from ' + caller[-1] if $FAST_REQUIRE_DEBUG
|
221
|
+
if known_loc = @@require_locs[lib]
|
222
|
+
if @@already_loaded[known_loc]
|
223
|
+
p 'already loaded ' + known_loc + ' ' + lib if $FAST_REQUIRE_DEBUG
|
224
|
+
return false
|
225
|
+
end
|
226
|
+
@@already_loaded[known_loc] = true
|
227
|
+
if known_loc =~ /\.#{RbConfig::CONFIG['DLEXT']}$/ or known_loc.include? "tar_input.rb"
|
228
|
+
puts 'doing original_non_cached_require on .so full path ' + known_loc if $FAST_REQUIRE_DEBUG
|
229
|
+
original_non_cached_require known_loc # not much we can do there...too bad...well at least we pass it a full path though :P
|
230
|
+
else
|
231
|
+
unless $LOADED_FEATURES.include? known_loc
|
232
|
+
if known_loc =~ /rubygems.rb$/
|
233
|
+
puts 'requiring rubygems ' + lib if $FAST_REQUIRE_DEBUG
|
234
|
+
original_non_cached_require(lib) # revert to normal require so rubygems doesn't freak out when it finds itself already in $LOADED_FEATURES with rubygems > 1.6 :P
|
235
|
+
else
|
236
|
+
IN_PROCESS << known_loc
|
237
|
+
begin
|
238
|
+
if $FAST_REQUIRE_DEBUG
|
239
|
+
puts 'doing cached loc eval on ' + lib + '=>' + known_loc + " with stack:" + IN_PROCESS.join(' ')
|
240
|
+
end
|
241
|
+
$LOADED_FEATURES << known_loc
|
242
|
+
# fakely add the load path, too, so that autoload for the same file/path in gems will work <sigh> [rspec2]
|
243
|
+
no_suffix_full_path = known_loc.gsub(/\.[^.]+$/, '')
|
244
|
+
no_suffix_lib = lib.gsub(/\.[^.]+$/, '')
|
245
|
+
libs_path = no_suffix_full_path.gsub(no_suffix_lib, '')
|
246
|
+
libs_path = File.expand_path(libs_path) # strip off trailing '/'
|
247
|
+
|
248
|
+
$: << libs_path unless $:.index(libs_path) # add in this ones real require path, so that neighboring autoloads will work
|
249
|
+
known_locs_dir = File.dirname(known_loc)
|
250
|
+
$: << known_locs_dir unless $:.index(known_locs_dir) # attempt to avoid the regin loading bug...yipes.
|
251
|
+
|
252
|
+
# try some more autoload conivings...so that it won't attempt to autoload if it runs into it later...
|
253
|
+
relative_full_path = known_loc.sub(libs_path, '')[1..-1]
|
254
|
+
$LOADED_FEATURES << relative_full_path unless $LOADED_FEATURES.index(relative_full_path) # add in with .rb, too, for autoload
|
255
|
+
|
256
|
+
# load(known_loc, false) # too slow
|
257
|
+
|
258
|
+
# use eval: if this fails to load breaks re-save the offending file in binary mode, or file an issue on the faster_require tracker...
|
259
|
+
contents = File.open(known_loc, 'rb:utf-8') {|f| f.read} # read only costs 0.34/10.0 s...
|
260
|
+
if contents =~ /require_relative/ # =~ is faster apparently faster than .include?
|
261
|
+
load(known_loc, false) # load is slow, but overcomes a ruby core bug: http://redmine.ruby-lang.org/issues/4487
|
262
|
+
else
|
263
|
+
eval(contents, TOPLEVEL_BINDING, known_loc)
|
264
|
+
end
|
265
|
+
ensure
|
266
|
+
raise 'unexpected' unless IN_PROCESS.pop == known_loc
|
267
|
+
end
|
268
|
+
return true
|
269
|
+
end
|
270
|
+
else
|
271
|
+
puts 'ignoring already loaded [circular require?] ' + known_loc + ' ' + lib if $FAST_REQUIRE_DEBUG
|
272
|
+
end
|
273
|
+
end
|
274
|
+
else
|
275
|
+
# we don't know the location--let Ruby's original require do the heavy lifting for us here
|
276
|
+
old = $LOADED_FEATURES.dup
|
277
|
+
p 'doing old non-known location require ' + lib if $FAST_REQUIRE_DEBUG
|
278
|
+
if(original_non_cached_require(lib))
|
279
|
+
# debugger might land here the first time you run a script and it doesn't have a require
|
280
|
+
# cached yet...
|
281
|
+
new = $LOADED_FEATURES - old
|
282
|
+
found = new.last
|
283
|
+
|
284
|
+
# incredibly, in 1.8.x, this doesn't always get set to a full path.
|
285
|
+
if RUBY_VERSION < '1.9'
|
286
|
+
if !File.file?(found)
|
287
|
+
# discover the full path.
|
288
|
+
dir = $:.find{|path| File.file?(path + '/' + found)}
|
289
|
+
return true unless dir # give up, case jruby socket.jar "mysterious"
|
290
|
+
found = dir + '/' + found
|
291
|
+
end
|
292
|
+
found = File.expand_path(found);
|
293
|
+
end
|
294
|
+
puts 'found new loc:' + lib + '=>' + found if $FAST_REQUIRE_DEBUG
|
295
|
+
@@require_locs[lib] = found
|
296
|
+
@@already_loaded[found] = true
|
297
|
+
return true
|
298
|
+
else
|
299
|
+
|
300
|
+
# this is expected if it's for libraries required before faster_require was [like rbconfig]
|
301
|
+
# raise 'actually expected' + lib if RUBY_VERSION >= '1.9.0'
|
302
|
+
puts 'already loaded, apparently [require returned false], trying to discover how it was redundant... ' + lib if $FAST_REQUIRE_DEBUG
|
303
|
+
# this probably was something like
|
304
|
+
# the first pass was require 'regdeferred'
|
305
|
+
# now it's a different require 'regdeferred.rb'
|
306
|
+
# which fails (or vice versa)
|
307
|
+
# so figure out why
|
308
|
+
# calc location, expand, map back
|
309
|
+
where_found = FastRequire.guess_discover(lib, true)
|
310
|
+
if where_found
|
311
|
+
puts 'inferred lib loc:' + lib + '=>' + where_found if $FAST_REQUIRE_DEBUG
|
312
|
+
@@require_locs[lib] = where_found
|
313
|
+
# unfortunately if it's our first pass
|
314
|
+
# and we are in the middle of a "real" require
|
315
|
+
# that is circular
|
316
|
+
# then $LOADED_FEATURES or (AFAIK) nothing will have been set
|
317
|
+
# for us to be able to assert that
|
318
|
+
# so...I think we'll end up
|
319
|
+
# just fudging for a bit
|
320
|
+
# raise 'not found' unless @@already_loaded[where_found] # should have already been set...I think...
|
321
|
+
else
|
322
|
+
if $FAST_REQUIRE_DEBUG
|
323
|
+
# happens for enumerator XXXX
|
324
|
+
puts 'unable to infer ' + lib + ' location' if $FAST_REQUIRE_DEBUG
|
325
|
+
@@already_loaded[found] = true # so hacky...
|
326
|
+
end
|
327
|
+
end
|
328
|
+
return false # XXXX test all these return values
|
329
|
+
end
|
330
|
+
end
|
331
|
+
ensure
|
332
|
+
raise 'huh' unless ALL_IN_PROCESS.pop[0] == lib
|
333
|
+
end
|
334
|
+
end
|
335
|
+
|
336
|
+
end
|
337
|
+
|
338
|
+
module Kernel
|
339
|
+
|
340
|
+
# overwrite old require...
|
341
|
+
include FastRequire
|
342
|
+
if defined?(gem_original_require)
|
343
|
+
class << self
|
344
|
+
alias :original_remove_method :remove_method
|
345
|
+
|
346
|
+
def remove_method method # I think this actually might be needed <sigh>
|
347
|
+
if method.to_s == 'require'
|
348
|
+
#p 'not removing old require, since that\'s ours now'
|
349
|
+
else
|
350
|
+
original_remove_method method
|
351
|
+
end
|
352
|
+
end
|
353
|
+
|
354
|
+
end
|
355
|
+
|
356
|
+
# similarly overwrite this one...I guess...1.9.x...rubygems uses this as its default...I think...
|
357
|
+
alias :original_non_cached_require :gem_original_require
|
358
|
+
alias :gem_original_require :require_cached
|
359
|
+
else
|
360
|
+
alias :original_non_cached_require :require
|
361
|
+
alias :require :require_cached
|
362
|
+
end
|
363
|
+
end
|
364
|
+
|
365
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
require 'b'
|
@@ -0,0 +1,15 @@
|
|
1
|
+
$: << '.'
|
2
|
+
$: << 'files'
|
3
|
+
if true
|
4
|
+
require 'gem_after.rb'
|
5
|
+
else
|
6
|
+
p 'warning not using faster'
|
7
|
+
require 'rubygems'
|
8
|
+
end
|
9
|
+
require 'active_support'
|
10
|
+
raise 'poor acctive support' unless ActiveSupport::Inflector::Inflections.instance.plurals.length > 0
|
11
|
+
# d:/Ruby192/lib/ruby/gems/1.9.1/gems/diff-lcs-1.1.2/lib/diff/lcs/callbacks.rb:53: warning: already initialized constant SequenceCallbacks
|
12
|
+
require 'action_pack'
|
13
|
+
require 'action_pack'
|
14
|
+
|
15
|
+
# reproduce warning: already initialized constant JS_ESCAPE_MAP
|
data/spec/files/b.rb
ADDED
data/spec/files/c.rb
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
rm -rf %HOMEPATH%/.ruby_faster_require_cache
|
data/spec/files/d.rb
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require 'faster_require'
|
data/spec/files/e.rb
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require 'faster_require'
|
data/spec/files/fast.rb
ADDED
data/spec/files/fast2.rb
ADDED
@@ -0,0 +1,10 @@
|
|
1
|
+
$: << '.'
|
2
|
+
|
3
|
+
require '../lib/faster_require.rb'
|
4
|
+
require 'rubygems'
|
5
|
+
Gem::Specification
|
6
|
+
|
7
|
+
raise if FastRequire.already_loaded.to_a.flatten.grep(/files\/b.rb/).length > 0
|
8
|
+
require 'files/b.rb'
|
9
|
+
raise if(require 'files/b.rb')
|
10
|
+
raise 'lacking b.rb ' + FastRequire.already_loaded.to_a.join(' ') unless FastRequire.already_loaded.to_a.flatten.grep(/files\/b.rb/).length > 0
|
@@ -0,0 +1,10 @@
|
|
1
|
+
$: << '.'
|
2
|
+
require 'rubygems'
|
3
|
+
Gem::Specification
|
4
|
+
|
5
|
+
require '../lib/faster_require.rb'
|
6
|
+
|
7
|
+
raise if FastRequire.already_loaded.to_a.flatten.grep(/files\/b.rb/).length > 0
|
8
|
+
require 'files/b.rb'
|
9
|
+
raise if(require 'files/b.rb')
|
10
|
+
raise unless FastRequire.already_loaded.to_a.flatten.grep(/files\/b.rb/).length > 0
|
data/spec/files/large.rb
ADDED
@@ -0,0 +1,11 @@
|
|
1
|
+
$: << '.'
|
2
|
+
$: << 'files'
|
3
|
+
if true
|
4
|
+
require 'gem_after.rb'
|
5
|
+
else
|
6
|
+
p 'warning not using faster require'
|
7
|
+
require 'rubygems'
|
8
|
+
end
|
9
|
+
require 'ruby-debug'
|
10
|
+
require 'rspec'
|
11
|
+
# d:/Ruby192/lib/ruby/gems/1.9.1/gems/diff-lcs-1.1.2/lib/diff/lcs/callbacks.rb:53: warning: already initialized constant SequenceCallbacks
|
File without changes
|
@@ -0,0 +1,6 @@
|
|
1
|
+
require File.dirname(File.expand_path(__FILE__)) + '/../../lib/faster_require.rb'
|
2
|
+
raise if (require File.dirname(File.expand_path(__FILE__)) + '/../../lib/faster_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,7 @@
|
|
1
|
+
$: << '.'
|
2
|
+
$:.unshift 'bin'
|
3
|
+
require File.dirname(File.expand_path(__FILE__)) + '/../../lib/faster_require.rb'
|
4
|
+
require 'non_dot_rb.rb' # succeed
|
5
|
+
raise if 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
|
6
|
+
|
7
|
+
# unless my gem is working right
|
@@ -0,0 +1,6 @@
|
|
1
|
+
require File.dirname(File.expand_path(__FILE__)) + '/../../lib/faster_require.rb'
|
2
|
+
raise if (require File.dirname(File.expand_path(__FILE__)) + '/../../lib/faster_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
|
+
|
data/spec/files/slow.rb
ADDED
@@ -0,0 +1,10 @@
|
|
1
|
+
$: << '.'
|
2
|
+
|
3
|
+
require '../lib/faster_require.rb'
|
4
|
+
raise if FastRequire.already_loaded.to_a.flatten.grep(/files\/b.rb/).length > 0
|
5
|
+
require 'socket'
|
6
|
+
TCPSocket
|
7
|
+
require 'stringio'
|
8
|
+
StringIO
|
9
|
+
raise 'lacking socket ' + FastRequire.already_loaded.to_a.join(' ') unless FastRequire.already_loaded.to_a.flatten.grep(/socket/).length > 0
|
10
|
+
raise 'lacking stringio ' + FastRequire.already_loaded.to_a.join(' ') unless FastRequire.already_loaded.to_a.flatten.grep(/stringio/).length > 0
|
@@ -0,0 +1,210 @@
|
|
1
|
+
# could also set this here if desired: $FAST_REQUIRE_DEBUG = true
|
2
|
+
|
3
|
+
require 'rubygems'
|
4
|
+
require 'sane'
|
5
|
+
require 'benchmark' # Benchmark.realtime
|
6
|
+
|
7
|
+
raise 'double faster_require' if defined?($already_using_faster_require) # disallowed, since who knows what version the gem one is, and even if it's the same...confusion!
|
8
|
+
|
9
|
+
unless RUBY_PLATFORM =~ /java/ # ??
|
10
|
+
#require_relative '../lib/faster_require'
|
11
|
+
cached = '.cached_spec_locs' + RUBY_VERSION
|
12
|
+
# use it for our own local test specs
|
13
|
+
require 'rspec'
|
14
|
+
require_relative '../lib/faster_require'
|
15
|
+
# FastRequire.load cached if File.exist? cached
|
16
|
+
else
|
17
|
+
require 'rspec'
|
18
|
+
require_relative '../lib/faster_require'
|
19
|
+
end
|
20
|
+
|
21
|
+
describe "requires faster!" do
|
22
|
+
|
23
|
+
before do
|
24
|
+
FastRequire.clear_all!
|
25
|
+
@old_length = $LOADED_FEATURES.length
|
26
|
+
$b = 0
|
27
|
+
@ruby = OS.ruby_bin + " "
|
28
|
+
end
|
29
|
+
|
30
|
+
def with_file(filename = 'test')
|
31
|
+
FileUtils.touch filename + '.rb'
|
32
|
+
yield
|
33
|
+
FileUtils.rm filename + '.rb'
|
34
|
+
end
|
35
|
+
|
36
|
+
it "should be able to do a single require" do
|
37
|
+
Dir.chdir('files') do
|
38
|
+
old = $LOADED_FEATURES.dup
|
39
|
+
assert require('c')
|
40
|
+
assert !(require 'c')
|
41
|
+
new = $LOADED_FEATURES - old
|
42
|
+
raise new.inspect if new.length != 1
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
it "should be able to go two sub-requires deep appropriately" do
|
47
|
+
Dir.chdir('files') do
|
48
|
+
assert(require('a_requires_b'))
|
49
|
+
assert !(require 'a_requires_b')
|
50
|
+
assert !(require 'a_requires_b')
|
51
|
+
$b.should == 1
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
it "should be faster" do
|
56
|
+
Dir.chdir('files') do
|
57
|
+
slow = Benchmark.realtime { assert system("#{OS.ruby_bin} slow.rb")}
|
58
|
+
Benchmark.realtime { assert system("#{OS.ruby_bin} fast.rb")} # warmup
|
59
|
+
fast = Benchmark.realtime { assert system("#{OS.ruby_bin} fast.rb")}
|
60
|
+
pps 'fast', fast, 'slow', slow
|
61
|
+
assert fast < slow
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
it "should load rubygems for speed look" do
|
66
|
+
slow = Benchmark.realtime { assert system("#{OS.ruby_bin} files/time_just_loading_rubygems.rb")}
|
67
|
+
fast = Benchmark.realtime { assert system("#{OS.ruby_bin} files/time_just_loading_rubygems.rb")}
|
68
|
+
pps 'just loading rubygems [obviously depends on number of gems installed] at all: fast', fast, 'slow', slow
|
69
|
+
end
|
70
|
+
|
71
|
+
it "should work with large complex gem" do
|
72
|
+
Dir.chdir('files') do
|
73
|
+
3.times { assert(system("#{OS.ruby_bin} large.rb")) }
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
77
|
+
it "could cache the file contents, even, too, in theory...oh my"
|
78
|
+
|
79
|
+
it "could not re-save the cache file if it hasn't changed [?]"
|
80
|
+
|
81
|
+
it "should load .so files still, and only load them once" do
|
82
|
+
# from the ruby-prof gem
|
83
|
+
3.times { require 'ruby_prof.so'; RubyProf }
|
84
|
+
assert $LOADED_FEATURES.length == (@old_length + 1)
|
85
|
+
end
|
86
|
+
|
87
|
+
it "should add requires to $LOADED_FEATURES" do
|
88
|
+
with_file('file2') {require 'file2'}
|
89
|
+
assert ($LOADED_FEATURES.grep(/file2.rb/)).length > 0
|
90
|
+
assert $LOADED_FEATURES.length == (@old_length + 1)
|
91
|
+
end
|
92
|
+
|
93
|
+
it "should save a file as a cache in a dir" do
|
94
|
+
assert Dir[FastRequire.dir + '/*'].length == 0 # all clear
|
95
|
+
FastRequire.default_save
|
96
|
+
assert Dir[FastRequire.dir + '/*'].length > 0
|
97
|
+
end
|
98
|
+
|
99
|
+
it "should have different caches based on the file being run, and Dir.pwd" do
|
100
|
+
# this doesn't use the cache right first time if you, say, profile your script with ruby-prof, but hey.
|
101
|
+
assert Dir[FastRequire.dir + '/*'].length == 0 # all clear
|
102
|
+
Dir.chdir('files') do
|
103
|
+
assert system("ruby -I../../lib d.rb")
|
104
|
+
assert system("ruby -I../../lib e.rb")
|
105
|
+
assert system("ruby -C.. -I../lib files/e.rb")
|
106
|
+
end
|
107
|
+
assert Dir[FastRequire.dir + '/*'].length == 3
|
108
|
+
assert Dir[FastRequire.dir + '/*d.rb*'].length == 1 # use full path
|
109
|
+
assert Dir[FastRequire.dir + '/*e.rb*'].length == 2 # different Dir.pwd's
|
110
|
+
end
|
111
|
+
|
112
|
+
it "should ignore the pwd setting if you set a certain global variable" do
|
113
|
+
Dir.chdir('files') do
|
114
|
+
assert system("ruby -I../../lib file_that_sets_ignore_pwd_flag.rb")
|
115
|
+
assert system("ruby -C.. -I../lib files/file_that_sets_ignore_pwd_flag.rb")
|
116
|
+
end
|
117
|
+
assert Dir[FastRequire.dir + '/*file_*'].length == 1 # re-use a cache for the file, despite different Dir.pwd's
|
118
|
+
end
|
119
|
+
|
120
|
+
it "should not die if it hits a poor cache file" do
|
121
|
+
FastRequire.clear_all!
|
122
|
+
assert system("ruby -Ilib files/fast.rb")
|
123
|
+
files = Dir[FastRequire.dir + '/*']
|
124
|
+
assert files.length == 1
|
125
|
+
File.open(files[0], 'w') {} # clear it, which is bad marshal data
|
126
|
+
assert system("ruby -Ilib files/fast.rb")
|
127
|
+
end
|
128
|
+
|
129
|
+
it "should work with encoded files too" # most are ascii, so...low prio
|
130
|
+
|
131
|
+
private
|
132
|
+
|
133
|
+
def ruby filename
|
134
|
+
command = @ruby + " " + filename
|
135
|
+
3.times { |n| raise command + " failed #{n}th time with zero as first" unless system(command) }
|
136
|
+
end
|
137
|
+
|
138
|
+
it "should override rubygems' require if rubygems is loaded after the fact...maybe by hooking to Gem::const_defined or something" do
|
139
|
+
ruby "files/gem_after.rb"
|
140
|
+
end
|
141
|
+
|
142
|
+
it "should override rubygems' require if rubygems is loaded before the fact" do
|
143
|
+
ruby "files/gem_before.rb"
|
144
|
+
end
|
145
|
+
|
146
|
+
['require_facets.rb', 'gem_after.rb', 'load_various_gems.rb', 'load_various_gems2.rb', 'active_support_no_double_load.rb', 'fast.rb'].each{|filename|
|
147
|
+
it "should not double load gems #{@ruby} -v files/#{filename}" do
|
148
|
+
3.times {
|
149
|
+
a = `#{@ruby} -v files/#{filename} 2>&1`
|
150
|
+
a.should_not match('already initialized')
|
151
|
+
a.should_not match('from ') # an error backtrace...
|
152
|
+
a.should_not match('discarding old deep_const_get')
|
153
|
+
a.length.should be > 0
|
154
|
+
}
|
155
|
+
end
|
156
|
+
}
|
157
|
+
|
158
|
+
it "should be ok if you require itself twice" do
|
159
|
+
Dir.chdir('files') do
|
160
|
+
3.times { assert system(@ruby + 'attempt_double_load.rb') }
|
161
|
+
assert `#{@ruby + 'attempt_double_load.rb'}` =~ /double load--expected\?/
|
162
|
+
end
|
163
|
+
end
|
164
|
+
|
165
|
+
it "require 'abc' should not attempt to load file called exactly abc" do
|
166
|
+
Dir.chdir('files') do
|
167
|
+
ruby 'require_non_dot_rb_fails.rb'
|
168
|
+
end
|
169
|
+
end
|
170
|
+
|
171
|
+
it "should handle full path requires" do
|
172
|
+
Dir.chdir('files') do
|
173
|
+
ruby 'require_full_path.rb'
|
174
|
+
end
|
175
|
+
end
|
176
|
+
|
177
|
+
it "should handle Pathname requires, too" do
|
178
|
+
require 'pathname'
|
179
|
+
require Pathname.new('pathname')
|
180
|
+
end
|
181
|
+
|
182
|
+
it "should work well with rubygems for gem libs (installed), themselves"
|
183
|
+
|
184
|
+
it "should disallow a file requiring itself" do
|
185
|
+
ruby 'files/requires_itself.rb'
|
186
|
+
end
|
187
|
+
|
188
|
+
it "should put modules in the right place" do
|
189
|
+
Dir.chdir('files') do
|
190
|
+
ruby 'should_put_modules_in_right_place.rb'
|
191
|
+
end
|
192
|
+
end
|
193
|
+
|
194
|
+
it "should do this type loading too" do
|
195
|
+
Dir.chdir('files') do
|
196
|
+
ruby 'fast2.rb'
|
197
|
+
end
|
198
|
+
end
|
199
|
+
|
200
|
+
it "should work for gems that tweak the load path, from within themselves, for their own autoload [boo]" do
|
201
|
+
ruby 'files/regin_gem.rb'
|
202
|
+
end
|
203
|
+
|
204
|
+
# was there some failure like
|
205
|
+
# stringio or enumerator.so?
|
206
|
+
it "should be able to infer .so files" #do
|
207
|
+
# ruby "files/socket_load.rb" # LODO reproduce failure first, from this file?
|
208
|
+
# end
|
209
|
+
|
210
|
+
end
|
data/todo
ADDED
metadata
ADDED
@@ -0,0 +1,252 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: ks_faster_require
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.9.4
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Roger Pack
|
9
|
+
- faisal
|
10
|
+
- Karl Stoney
|
11
|
+
autorequire:
|
12
|
+
bindir: bin
|
13
|
+
cert_chain: []
|
14
|
+
date: 2014-04-28 00:00:00.000000000 Z
|
15
|
+
dependencies:
|
16
|
+
- !ruby/object:Gem::Dependency
|
17
|
+
name: redparse
|
18
|
+
requirement: !ruby/object:Gem::Requirement
|
19
|
+
none: false
|
20
|
+
requirements:
|
21
|
+
- - ! '>='
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: '0'
|
24
|
+
type: :development
|
25
|
+
prerelease: false
|
26
|
+
version_requirements: !ruby/object:Gem::Requirement
|
27
|
+
none: false
|
28
|
+
requirements:
|
29
|
+
- - ! '>='
|
30
|
+
- !ruby/object:Gem::Version
|
31
|
+
version: '0'
|
32
|
+
- !ruby/object:Gem::Dependency
|
33
|
+
name: activesupport
|
34
|
+
requirement: !ruby/object:Gem::Requirement
|
35
|
+
none: false
|
36
|
+
requirements:
|
37
|
+
- - '='
|
38
|
+
- !ruby/object:Gem::Version
|
39
|
+
version: 2.3.10
|
40
|
+
type: :development
|
41
|
+
prerelease: false
|
42
|
+
version_requirements: !ruby/object:Gem::Requirement
|
43
|
+
none: false
|
44
|
+
requirements:
|
45
|
+
- - '='
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 2.3.10
|
48
|
+
- !ruby/object:Gem::Dependency
|
49
|
+
name: actionpack
|
50
|
+
requirement: !ruby/object:Gem::Requirement
|
51
|
+
none: false
|
52
|
+
requirements:
|
53
|
+
- - '='
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
version: 2.3.10
|
56
|
+
type: :development
|
57
|
+
prerelease: false
|
58
|
+
version_requirements: !ruby/object:Gem::Requirement
|
59
|
+
none: false
|
60
|
+
requirements:
|
61
|
+
- - '='
|
62
|
+
- !ruby/object:Gem::Version
|
63
|
+
version: 2.3.10
|
64
|
+
- !ruby/object:Gem::Dependency
|
65
|
+
name: jeweler
|
66
|
+
requirement: !ruby/object:Gem::Requirement
|
67
|
+
none: false
|
68
|
+
requirements:
|
69
|
+
- - ! '>='
|
70
|
+
- !ruby/object:Gem::Version
|
71
|
+
version: '0'
|
72
|
+
type: :development
|
73
|
+
prerelease: false
|
74
|
+
version_requirements: !ruby/object:Gem::Requirement
|
75
|
+
none: false
|
76
|
+
requirements:
|
77
|
+
- - ! '>='
|
78
|
+
- !ruby/object:Gem::Version
|
79
|
+
version: '0'
|
80
|
+
- !ruby/object:Gem::Dependency
|
81
|
+
name: rspec
|
82
|
+
requirement: !ruby/object:Gem::Requirement
|
83
|
+
none: false
|
84
|
+
requirements:
|
85
|
+
- - ! '>='
|
86
|
+
- !ruby/object:Gem::Version
|
87
|
+
version: '2'
|
88
|
+
type: :development
|
89
|
+
prerelease: false
|
90
|
+
version_requirements: !ruby/object:Gem::Requirement
|
91
|
+
none: false
|
92
|
+
requirements:
|
93
|
+
- - ! '>='
|
94
|
+
- !ruby/object:Gem::Version
|
95
|
+
version: '2'
|
96
|
+
- !ruby/object:Gem::Dependency
|
97
|
+
name: sane
|
98
|
+
requirement: !ruby/object:Gem::Requirement
|
99
|
+
none: false
|
100
|
+
requirements:
|
101
|
+
- - ! '>='
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
none: false
|
108
|
+
requirements:
|
109
|
+
- - ! '>='
|
110
|
+
- !ruby/object:Gem::Version
|
111
|
+
version: '0'
|
112
|
+
- !ruby/object:Gem::Dependency
|
113
|
+
name: facets
|
114
|
+
requirement: !ruby/object:Gem::Requirement
|
115
|
+
none: false
|
116
|
+
requirements:
|
117
|
+
- - ! '>='
|
118
|
+
- !ruby/object:Gem::Version
|
119
|
+
version: '0'
|
120
|
+
type: :development
|
121
|
+
prerelease: false
|
122
|
+
version_requirements: !ruby/object:Gem::Requirement
|
123
|
+
none: false
|
124
|
+
requirements:
|
125
|
+
- - ! '>='
|
126
|
+
- !ruby/object:Gem::Version
|
127
|
+
version: '0'
|
128
|
+
- !ruby/object:Gem::Dependency
|
129
|
+
name: ruby-prof
|
130
|
+
requirement: !ruby/object:Gem::Requirement
|
131
|
+
none: false
|
132
|
+
requirements:
|
133
|
+
- - ! '>='
|
134
|
+
- !ruby/object:Gem::Version
|
135
|
+
version: '0'
|
136
|
+
type: :development
|
137
|
+
prerelease: false
|
138
|
+
version_requirements: !ruby/object:Gem::Requirement
|
139
|
+
none: false
|
140
|
+
requirements:
|
141
|
+
- - ! '>='
|
142
|
+
- !ruby/object:Gem::Version
|
143
|
+
version: '0'
|
144
|
+
- !ruby/object:Gem::Dependency
|
145
|
+
name: rack-mount
|
146
|
+
requirement: !ruby/object:Gem::Requirement
|
147
|
+
none: false
|
148
|
+
requirements:
|
149
|
+
- - '='
|
150
|
+
- !ruby/object:Gem::Version
|
151
|
+
version: 0.6.14
|
152
|
+
type: :development
|
153
|
+
prerelease: false
|
154
|
+
version_requirements: !ruby/object:Gem::Requirement
|
155
|
+
none: false
|
156
|
+
requirements:
|
157
|
+
- - '='
|
158
|
+
- !ruby/object:Gem::Version
|
159
|
+
version: 0.6.14
|
160
|
+
- !ruby/object:Gem::Dependency
|
161
|
+
name: rack
|
162
|
+
requirement: !ruby/object:Gem::Requirement
|
163
|
+
none: false
|
164
|
+
requirements:
|
165
|
+
- - '='
|
166
|
+
- !ruby/object:Gem::Version
|
167
|
+
version: 1.2.2
|
168
|
+
type: :development
|
169
|
+
prerelease: false
|
170
|
+
version_requirements: !ruby/object:Gem::Requirement
|
171
|
+
none: false
|
172
|
+
requirements:
|
173
|
+
- - '='
|
174
|
+
- !ruby/object:Gem::Version
|
175
|
+
version: 1.2.2
|
176
|
+
description: Modified version of faster require to fix a UTF8 cygwin bug
|
177
|
+
email: karlstoney@gmail.com
|
178
|
+
executables:
|
179
|
+
- faster_require
|
180
|
+
extensions: []
|
181
|
+
extra_rdoc_files:
|
182
|
+
- ChangeLog
|
183
|
+
- LICENSE
|
184
|
+
- README
|
185
|
+
- TODO
|
186
|
+
files:
|
187
|
+
- ChangeLog
|
188
|
+
- LICENSE
|
189
|
+
- README
|
190
|
+
- Rakefile
|
191
|
+
- VERSION
|
192
|
+
- benchmark/benchmark.rb
|
193
|
+
- benchmark/benchmark_slow.rb
|
194
|
+
- bin/faster_require
|
195
|
+
- lib/faster_require.rb
|
196
|
+
- lib/rubygems_plugin.rb
|
197
|
+
- spec/files/a_requires_b.rb
|
198
|
+
- spec/files/active_support_no_double_load.rb
|
199
|
+
- spec/files/attempt_double_load.rb
|
200
|
+
- spec/files/attempt_double_load_wrong_version.rb
|
201
|
+
- spec/files/b.rb
|
202
|
+
- spec/files/c.rb
|
203
|
+
- spec/files/clear.bat
|
204
|
+
- spec/files/d.rb
|
205
|
+
- spec/files/e.rb
|
206
|
+
- spec/files/fast.rb
|
207
|
+
- spec/files/fast2.rb
|
208
|
+
- spec/files/file_that_sets_ignore_pwd_flag.rb
|
209
|
+
- spec/files/gem_after.rb
|
210
|
+
- spec/files/gem_before.rb
|
211
|
+
- spec/files/large.rb
|
212
|
+
- spec/files/load_various_gems.rb
|
213
|
+
- spec/files/load_various_gems2.rb
|
214
|
+
- spec/files/non_dot_rb.rb
|
215
|
+
- spec/files/regin_gem.rb
|
216
|
+
- spec/files/require_facets.rb
|
217
|
+
- spec/files/require_full_path.rb
|
218
|
+
- spec/files/require_non_dot_rb_fails.rb
|
219
|
+
- spec/files/require_twice_in_dir_pwd.rb
|
220
|
+
- spec/files/requires_itself.rb
|
221
|
+
- spec/files/should_put_modules_in_right_place.rb
|
222
|
+
- spec/files/slow.rb
|
223
|
+
- spec/files/socket_load.rb
|
224
|
+
- spec/files/time_just_loading_rubygems.rb
|
225
|
+
- spec/spec.fast_require.rb
|
226
|
+
- todo
|
227
|
+
- TODO
|
228
|
+
homepage: https://github.com/Stono/faster_require
|
229
|
+
licenses: []
|
230
|
+
post_install_message:
|
231
|
+
rdoc_options: []
|
232
|
+
require_paths:
|
233
|
+
- lib
|
234
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
235
|
+
none: false
|
236
|
+
requirements:
|
237
|
+
- - ! '>='
|
238
|
+
- !ruby/object:Gem::Version
|
239
|
+
version: '0'
|
240
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
241
|
+
none: false
|
242
|
+
requirements:
|
243
|
+
- - ! '>='
|
244
|
+
- !ruby/object:Gem::Version
|
245
|
+
version: '0'
|
246
|
+
requirements: []
|
247
|
+
rubyforge_project:
|
248
|
+
rubygems_version: 1.8.23
|
249
|
+
signing_key:
|
250
|
+
specification_version: 3
|
251
|
+
summary: Speed library loading in Ruby
|
252
|
+
test_files: []
|