On Aug 14, 6:40 pm, Jim Weirich <j... / weirichhouse.org> wrote:
> unknown wrote:
> > Israkesupposed to be reallyslow?
>
> > I'm using InstantRails and runningrakein a project with one unit
> > test and two functional tests and it takes 33 seconds total. Is that
> > normal? It seems reallyslowto me.
>
> > When I turn on trace I can see that it spends most of its time in
> > "Execute environment" and loading the test files:
>
> > C:/InstantRails/ruby/bin/ruby -Ilib;test "C:/InstantRails/ruby/lib/
> > ruby/gems/1.8/gems/rake-0.7.2/lib/rake/rake_test_loader.rb" "test/unit/
> > user_test.rb"
>
> > Anyone else have this problem or is it normal? Thanks.
>
> Rakein and of itself is quite fast.  There are two types of things that
> canslowyou down.
>
> (1) Executing the Rakefile. If you have lots of tasks or complex
> dependencies, then whatever time it takes to resolve those can build up
> andslowdown everyrakecommand.
>
> (2)Slowtasks.  Some tasks inrakeare naturelyslow.  Slowtakes make
> anything that depends upon themslowas well.
>
> I assume you are working in Rails?  Add this to your top level Rakefile:
>
>    task :noop
>
> Then time the "rakenoop" command.  This will be the time it takesrake
> to run essentially a do nothing task and will give you a sense of the
> general Rakefile overhead.
>
> Then time "rakeenvironment".  This task loads the rails environment and
> can take some time.  The environment task is a dependency of most rails
> relatedraketasks in a Rails project.
>
> In the project I'm currently working on, "rakenoop" takes under a
> second.  "rakeenvironment" takes nearly 3 seconds.  ("rakenoop" in a
> lightweight non-rails project takes under 0.2 seconds).
>
> It sounds like the environment task on your system is painfullyslow.
> Is it doing anything unusual?
>
> -- Jim Weirich
>
> --
> Posted viahttp://www.ruby-forum.com/.

Thanks for the replies. Yes I'm working with rails. I think you are
both right. Running a single unit test without rake takes about 11
seconds (even though it says it finished in 0.118 seconds). The test
simply creates a new user in my User model. So maybe it's taking a
while to connect to my mysql db? I'll have to investigate that (not
sure how to though). rake environment takes about 13 seconds. Where is
the environment task defined? I'd like to take a look at it to see
what it's doing. Using rake to run that one unit test takes 24
seconds, so it's definitely a combination of the environment task
being painfully slow and the test itself being slow too.

Thanks again for the help Jim and Ryan.