faster_require 0.7.2 → 0.7.3

Sign up to get free protection for your applications and to get access to all the features.
data/README CHANGED
@@ -20,8 +20,16 @@ loading a (blank) rspec file:
20
20
  without 3.6s
21
21
  with 1.25s
22
22
 
23
+
24
+ rails app, running a unit test file
23
25
 
24
- rails app, running script/console "puts 333"
26
+ 1.8.6
27
+ without:
28
+ 23s
29
+ with:
30
+ 14s
31
+
32
+ rails app, running $ script/console "puts 333"
25
33
 
26
34
  1.9.1
27
35
  without:
@@ -47,9 +55,6 @@ running "rake -T"
47
55
 
48
56
  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.
49
57
 
50
- [1] If anybody asks me for it, I'll come up with a way to *always* preload this when using rubygems, to speed up "everything" [hopefully]. Note also that
51
- if things get corrupted or messed up, you can run the (included) faster_require command/script ($ faster_require --clear-cache) and it will clear it.
52
-
53
58
  == How to use in Rails ==
54
59
 
55
60
  You can either install the gem, then add a
@@ -65,14 +70,36 @@ $ gem unpack faster_require
65
70
 
66
71
  Now add this line to your config/environment.rb:
67
72
 
68
- 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 downloaded.
73
+ 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.
69
74
 
70
75
  add it *before* this other (existing) line:
71
76
 
72
77
  require File.join(File.dirname(__FILE__), 'boot')
73
78
 
74
- Now it will speedup loading rubygems and everything. Happiness.
79
+ Now it will speedup loading rubygems and everything. Happiness. (NB that setting it this will also run in production mode code, so be careful here, though it does work for me in production).
80
+
81
+ == clearing cache ==
82
+
83
+ If you use bundler to change bundled gems, you'll want to run the command $ faster_require --clear-cache
84
+ so that it will pick up the new load paths. Also if you moves files around to new paths, you may want to do the same.
85
+ As you install any new gems, it should clear the paths automatically for you.
86
+
87
+ == How to use generally ==
88
+
89
+ You can install it to be used "always" (well, for anything that loads rubygems, at least, via something like the following):
90
+
91
+ $ gem which rubygems
92
+ d:/Ruby192/lib/ruby/site_ruby/1.9.1/rubygems.rb
93
+
94
+ $ gem which faster_require
95
+ d:/Ruby192/lib/ruby/gems/1.9.1/gems/faster_require-0.6.0/lib/faster_require.rb
96
+
97
+ Now edit that rubygems.rb file, and add a require line to the top of it like this:
98
+
99
+ require 'd:/Ruby192/lib/ruby/gems/1.9.1/gems/faster_require-0.6.0/lib/faster_require.rb'
75
100
 
76
- Any problems report back: https://github.com/rdp/faster_require
101
+ update the path for your own, obviously. You'll also have to change that added line if
102
+ you ever install a newer version of faster_require gem, or if you update your version of rubygems,
103
+ as the rubygems.rb file will be wiped clean at that point.
77
104
 
78
105
  Enjoy.
data/TODO ADDED
@@ -0,0 +1,5 @@
1
+ advertise if quiet for a week after 3/10/11
2
+ stringio
3
+ if ruby < 1.9 for autoload stuff
4
+ benchmarks jruby et al
5
+ running rails seems to still have some redundancies in there [?]
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.7.2
1
+ 0.7.3
@@ -184,7 +184,12 @@ module FastRequire
184
184
  $LOADED_FEATURES << relative_full_path # add in with .rb, too.
185
185
 
186
186
  # load(known_loc, false) # too slow
187
- eval(File.open(known_loc, 'rb') {|f| f.read}, TOPLEVEL_BINDING, known_loc) # note the 'rb' here--this means it's reading .rb files as binary, which *typically* works...maybe unnecessary though?
187
+ contents = File.open(known_loc, 'rb') {|f| f.read}
188
+ if contents =~ /require_relative/ # =~ is faster than .include? it appears
189
+ load(known_loc, false) # slow, but dependent on a ruby core bug: http://redmine.ruby-lang.org/issues/4487
190
+ else
191
+ eval(contents, TOPLEVEL_BINDING, known_loc) # note the 'rb' here--this means it's reading .rb files as binary, which *typically* works...maybe unnecessary though?
192
+ end
188
193
  ensure
189
194
  raise 'unexpected' unless IN_PROCESS.pop == known_loc
190
195
  end
@@ -76,7 +76,7 @@ describe "requires faster!" do
76
76
  end
77
77
  end
78
78
 
79
- it "could cache file contents, too, in theory...oh my"
79
+ it "could cache the file contents, even, too, in theory...oh my"
80
80
 
81
81
  it "should not re-save the cache file if it hasn't changed [?]"
82
82
 
data/todo ADDED
@@ -0,0 +1,5 @@
1
+ advertise if quiet for a week after 3/10/11
2
+ stringio
3
+ if ruby < 1.9 for autoload stuff
4
+ benchmarks jruby et al
5
+ running rails seems to still have some redundancies in there [?]
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: faster_require
3
3
  version: !ruby/object:Gem::Version
4
- hash: 7
4
+ hash: 5
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 7
9
- - 2
10
- version: 0.7.2
9
+ - 3
10
+ version: 0.7.3
11
11
  platform: ruby
12
12
  authors:
13
13
  - Roger Pack
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-03-09 00:00:00 -07:00
18
+ date: 2011-03-10 00:00:00 -07:00
19
19
  default_executable: faster_require
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -129,6 +129,7 @@ extensions: []
129
129
  extra_rdoc_files:
130
130
  - ChangeLog
131
131
  - README
132
+ - TODO
132
133
  files:
133
134
  - ChangeLog
134
135
  - README
@@ -161,6 +162,8 @@ files:
161
162
  - spec/files/should_put_modules_in_right_place.rb
162
163
  - spec/files/slow.rb
163
164
  - spec/spec.fast_require.rb
165
+ - todo
166
+ - TODO
164
167
  - spec/eval_me1.rb
165
168
  - spec/eval_me2.rb
166
169
  - spec/files/a.rb