Can I speed up Rails' startup time

Hi all,

I'd give $100 to shave 10 seconds off the time it takes for the Rails environment to come up. I like to do test-driven development, running tests both from within the IDE (one test method at a time) and via rake. From the IDE, the Rails startup time is kicking my butt - it takes 0.2 seconds to run the test and 19 seconds for the Rails environment to initialize.

It also stinks when I want to pop into to script\console and check something.

Does anyone know any tricks to speed up the intialization, maybe disabling features that don't apply in some situations?

Thanks!

Brian

You can take a look in your environment.rb file and do a little gardening in there... you might gain a bit on your load times.

  # Settings in config/environments/* take precedence over those specified here.   # Application configuration should go into files in config/initializers   # -- all .rb files in that directory are automatically loaded.   # See Rails::Configuration for more options.

  # Skip frameworks you're not going to use (only works if using vendor/rails).   # To use Rails without a database, you must remove the Active Record framework   # config.frameworks -= [ :active_record, :active_resource, :action_mailer ]

  # Only load the plugins named here, in the order given. By default, all plugins   # in vendor/plugins are loaded in alphabetical order.   # :all can be used as a placeholder for all plugins not explicitly named   # config.plugins = [ :exception_notification, :ssl_requirement, :all ]

Hi all,

I'd give $100 to shave 10 seconds off the time it takes for the Rails environment to come up. I like to do test-driven development, running tests both from within the IDE (one test method at a time) and via
rake. From the IDE, the Rails startup time is kicking my butt - it takes 0.2 seconds to run the test and 19 seconds for the Rails environment to initialize.

It also stinks when I want to pop into to script\console and check something.

That does sound pretty bad. On a smallish app with not too many tests
cases/fixtures to load, a full test run comes in at 8 seconds, script/ console about 2-3 seconds. On a bigger app it's about 16 seconds but
there's an awful lot more code and tests in that second one. Running
one individual test file seems to be roughly 2-3s plus the actual cost
of the tests themselves. I haven't done anything in particular to
achieve this so it's quite curious that you see such mediocre startup
time.

Fred

He’s not the only one. I too have giant startup times, anywhere between 10-15 seconds.The most simple test, script/about, took 12 seconds for me. I’m running

Windows XP SP3 RoR 2.0.2

Any help would be greatly appreciated.

Regards Kieran

(my previous email seems to have been rejected :S sorry if this is a duplicate)

Hey,

He’s not the only one. I too have giant startup times, anywhere between 10-15 seconds.The most simple test, script/about, took 12 seconds for me. I’m running

Windows XP SP3 RoR 2.0.2

Any help would be greatly appreciated.

Regards Kieran

(my previous email seems to have been rejected :S sorry if this is a
duplicate)

Hey,

He's not the only one. I too have giant startup times, anywhere
between 10-15 seconds.The most simple test, script/about, took 12
seconds for me. I'm running

About 2-3 seconds on my mac (2.4Ghz core2duo) . I've read (

http://panthersoftware.com/articles/view/2/rails-unit-testing-is-slow-under-cygwin-and-windows-solutions-alternatives   among others) that ruby on windows is substantially slower than on
mac os x or linux (to the extent that running ruby on linux in a vm is
faster than a native windows ruby), but I don't know if that accounts
for the whole picture

Fred

Here's a quick test I ran on my Mac Pro on a smallish application using rSpec as the test framework:

This was run from this very simple script:

Windoze? Did I win?

As others have remarked, it’s your use of Windows. I’m using Windows at work (ugh) and it’s markedly slows than Linux or Mac OS for Ruby. That said, have you considered using ActiveRecord Struct (see http://blog.jayfields.com/2007/10/rails-unit-test-without-rails.html)? I’ve not used it personally, but it sounds quite promising.

James H.

James Herdman wrote:

As others have remarked, it's your use of Windows. I'm using Windows at work (ugh) and it's markedly slows than Linux or Mac OS for Ruby. That said, have you considered using ActiveRecord Struct (see Jay Fields' Thoughts: Rails: Unit Test without Rails)? I've not used it personally, but it sounds quite promising.

James H.

I'll look at that, as well as giving it a try on a Linux box.

Thanks,

Brian