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
...

4 comments
Comments feed for this article
2009-11-07 at 4:44:42
Tim Harper
Or… you could set config.cache_classes = false (the responsible config setting that invoked eager loading).
Tim
2009-11-07 at 6:27:51
pragmatig
yes, this works as replacement for the second hack, ill add it to the instructions, thanks
2009-11-15 at 8:12:13
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
2011-07-28 at 18:38:08
Brian Chapman
Thank you for this hack. Saved a lot of time!!