Permalink
Browse files

Just track "require" if we have something in the watching stack.

A patch has been provided earlier and we have asked for feedback:

    https://gist.github.com/1437939

Except one case, all other cases showed improvements in boot time.
  • Loading branch information...
1 parent 9dee540 commit 885a599303585b796da7a0a1c3ccd0bc5c642134 @josevalim josevalim committed Dec 6, 2011
Showing with 5 additions and 1 deletion.
  1. +5 −1 activesupport/lib/active_support/dependencies.rb
View
6 activesupport/lib/active_support/dependencies.rb
@@ -87,6 +87,10 @@ def each(&block)
@stack.each(&block)
end
+ def watching?
+ !@watching.empty?
+ end
+
# return a list of new constants found since the last call to watch_namespaces
def new_constants
constants = []
@@ -226,7 +230,7 @@ def require_association(file_name)
end
def load_dependency(file)
- if Dependencies.load?
+ if Dependencies.load? && ActiveSupport::Dependencies.constant_watch_stack.watching?
Dependencies.new_constants_in(Object) { yield }
else
yield

3 comments on commit 885a599

@arunagw
Ruby on Rails member

❤️

@ugisozols

👍

@asanghi

backport to 3.0 branch please!!

Please sign in to comment.