If you noticed spork startup getting slower when switching to Rails 2.3, your not alone
- Views are eager loaded
- app/ is eager loaded (when config.cache_classes is on)
Without hack: 18s startup
With hack: 2s startup
Try it
#spec/spec_helper.rb
begin
require 'spork/app_framework/rails'
module Spork::AppFramework::Rails::NinjaPatcher
# views are preloaded spork must be restarted for view changes
def delay_eager_view_loading
puts "removed because i am too slow..."
end
# do not preload application files
# alternatively urn off config.cache_classes
def delay_app_preload
::Rails::Initializer.send(:define_method, :load_application_classes) do
end
end
end
rescue
end
Spork.prefork do
...

3 comments
Comments feed for this article
November 7, 2009 at 4:44
Tim Harper
Or… you could set config.cache_classes = false (the responsible config setting that invoked eager loading).
Tim
November 7, 2009 at 6:27
pragmatig
yes, this works as replacement for the second hack, ill add it to the instructions, thanks
November 15, 2009 at 8:12
taylor luk
Hello
That delay_app_preload method fixed cucumber preloading issue when cache_classes = true..
However, that delay view logic has view can’t be reloaded problem..
thx for sharing