Windows isn't best platform for Ruby development and definitely it isn't for Rails 3. My basic integration test script takes about 30 seconds to run, which 28 seconds of that is Rails environment startup. I found that the bottleneck is Kernel#require and indirectly gem loading. In many places all the same libraries are requested by require which isn't really needed once library was loaded in previous invocations.

I wrote a code to speed-up framework startup by detecting such duplicate requests and cache results.

if not $SPEEDUP_LIBCACHE and ENV['RAILS_ENV'] != 'production'
  # speedup Rails 3 startup by 30% on Windows
  $SPEEDUP_LIBCACHE = {}
  module Kernel
    alias chained_require require
    def require(path)
      $SPEEDUP_LIBCACHE[path] ||= chained_require path
    end
    private :require
    private :chained_require
  end
end

I have placed the above snippet on the top of config/environment.rb of my Rails app. Now standalone invocation of test script takes about 20 seconds instead of 30s - this is above 30% improvement.

I have tested trick with Ruby 1.8.7-p249 from RubyInstaller. I also tested 1.9.1-p378 and the same test script finishes in 36 sec as opposed to 46 sec without the mod - about 22% faster. The tests were run on Windows XP, HP C2D 1.6GHz laptop with 2GB of RAM.

The library caching is only performed in development and test mode. Generally my Rails 3 application works faster and without any problems, but I would not suggest using this trick in production mode as application start-ups are rare and somehow unknown bugs may appear. Use at your own risk.