Skip to content

Commit 726efff

Browse files
committed
Avoid eager load
According to my testing, it did not provide a great benefit on subsequent runs, but in my app it made the initial load go from about 4 seconds to 8. Therefore better to avoid it in this use case I think.
1 parent 3a9e08c commit 726efff

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

lib/spring/application.rb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,12 @@ def start
2626
ActiveSupport::Dependencies.mechanism = :load
2727
end
2828

29+
# Ensure eager loading does not take place, even though it usually would do
30+
# in test mode with config.cache_classes = true. Eager loading in this situation
31+
# just makes the initial run take longer without much gain in subsequent runs,
32+
# at least in my testing.
33+
Rails::Application::Finisher.initializers.delete_if { |i| i.name == :eager_load! }
34+
2935
require Spring.application_root_path.join("config", "environment")
3036

3137
Rails.application.config.cache_classes = false

0 commit comments

Comments
 (0)