From: Jim Weirich Date: 2007-08-15T07:40:44+09:00 Subject: Re: Why is rake really slow? unknown wrote: > Is rake supposed to be really slow? > > I'm using InstantRails and running rake in a project with one unit > test and two functional tests and it takes 33 seconds total. Is that > normal? It seems really slow to 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. Rake in and of itself is quite fast. There are two types of things that can slow you 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 and slow down every rake command. (2) Slow tasks. Some tasks in rake are naturely slow. Slow takes make anything that depends upon them slow as well. I assume you are working in Rails? Add this to your top level Rakefile: task :noop Then time the "rake noop" command. This will be the time it takes rake to run essentially a do nothing task and will give you a sense of the general Rakefile overhead. Then time "rake environment". This task loads the rails environment and can take some time. The environment task is a dependency of most rails related rake tasks in a Rails project. In the project I'm currently working on, "rake noop" takes under a second. "rake environment" takes nearly 3 seconds. ("rake noop" in a lightweight non-rails project takes under 0.2 seconds). It sounds like the environment task on your system is painfully slow. Is it doing anything unusual? -- Jim Weirich -- Posted via http://www.ruby-forum.com/.