Jakub Arnold
Jakub Arnold

Reputation: 87230

Why are my specs while using Guard so slow?

When I run my specs using just spork, I get quite a significant performance increase

$ time rspec .
.....

Finished in 11.39 seconds
5 examples, 0 failures

real    0m11.780s
user    0m10.318s
sys     0m1.180s

and with spork

$ time rspec . --drb
.....

Finished in 107.24 seconds
5 examples, 0 failures

real    0m1.968s
user    0m0.488s
sys     0m0.095s

which is really awesome. But once I put guard into play, it seems that everything runs so slow, as if there was no spork at all.

$ guard
Guard is now watching at '/Users/darth/projects/scvrush'
Starting Spork for RSpec 
Using RSpec
Preloading Rails environment
Loading Spork.prefork block...
Spork is ready and listening on 8989!
Spork server for RSpec successfully started
Guard::RSpec is running, with RSpec 2!
Running all specs
.....

Finished in 10.77 seconds
5 examples, 0 failures

even if I don't look at the Finished in 10.77 seconds, I can count at least 6-8 seconds every time it tries to run a spec, even for just one model.

I did some minor edits to the Guardfile, such as :wait => 120, but that should only affect when guard is starting up.

Upvotes: 2

Views: 844

Answers (1)

Jari Jokinen
Jari Jokinen

Reputation: 770

You have to pass the --drb option for rspec in your Guardfile, like this:

guard 'rspec', :version => 2, :cli => '--drb' do
 ...
end

Upvotes: 2

Related Questions