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 ]

On 12 May 2008, at 18:01, Brian H. wrote:

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

(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

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

On Tue, May 13, 2008 at 8:43 AM, Frederick C. <

On 12 May 2008, at 22:13, Kieran P wrote:

(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://antoniocangiano.com/2007/02/19/ruby-implementations-shootout-ruby-vs-yarv-vs-jruby-vs-gardens-point-ruby-net-vs-rubinius-vs-cardinal/
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

On 5/12/08, Brian H. [email protected] wrote:

I’d give $100 to shave 10 seconds off the time it takes for the Rails
environment to come up.

Windoze? Did I win?


Greg D.
http://destiney.com/

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:

#!/bin/bash
date
rake spec
date

Results:

Mon May 12 19:55:34 EDT 2008

Finished in 0.881141 seconds

212 examples, 0 failures
Mon May 12 19:55:38 EDT 2008

Only accurate to the second, but as you can see total time to execute
was around 4 seconds.

So I’m guessing your problem is not directly related to Rails
initialization. There must be other factors involved.

BTW. This test was using Mongrel web server.

On May 12, 5:23 pm, Frederick C. [email protected]

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

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

Thanks,

Brian

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs