Jeremy Lightsmith
2009-Jan-28 20:21 UTC
[rspec-users] specs run faster separately than together
So this is weird. on my current project I''ve been working on speeding up specs, and I just found that time rake spec => 4m 0s whereas time rake spec:controllers spec:models spec:helpers spec:lib => 2m 32s (we don''t have any view specs) any idea why this might be true? I compared numbers of tests and got the same number both ways, just running everything together seems to make it take almost twice as long... Is anyone else seeing this? If it matters, we have 1183 tests spread more or less evenly across each of controllers, models, helpers, and lib. Jeremy -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/rspec-users/attachments/20090128/38fc7914/attachment.html>
Scott Taylor
2009-Jan-28 20:34 UTC
[rspec-users] specs run faster separately than together
On Jan 28, 2009, at 3:21 PM, Jeremy Lightsmith wrote:> So this is weird. > > on my current project I''ve been working on speeding up specs, and I > just found that > > time rake spec => 4m 0s > > whereas > > time rake spec:controllers spec:models spec:helpers spec:lib => 2m 32sDo those rake tasks run rake db:test:prepare, and other dependencies of rake spec? How are you getting those numbers? Scott> > > (we don''t have any view specs) any idea why this might be true? I > compared numbers of tests and got the same number both ways, just > running everything together seems to make it take almost twice as > long... Is anyone else seeing this? > > If it matters, we have 1183 tests spread more or less evenly across > each of controllers, models, helpers, and lib. > > Jeremy > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users
Jeremy Lightsmith
2009-Jan-28 21:05 UTC
[rspec-users] specs run faster separately than together
On Wed, Jan 28, 2009 at 12:34 PM, Scott Taylor <scott at railsnewbie.com>wrote:> > On Jan 28, 2009, at 3:21 PM, Jeremy Lightsmith wrote: > > So this is weird. >> >> on my current project I''ve been working on speeding up specs, and I just >> found that >> >> time rake spec => 4m 0s >> >> whereas >> >> time rake spec:controllers spec:models spec:helpers spec:lib => 2m 32s >> > > Do those rake tasks run rake db:test:prepare, and other dependencies of > rake spec? > > How are you getting those numbers? > > Scott >Each of those rake tasks are the default generated ones : Spec::Rake::SpecTask.new(sub => spec_prereq) do |t| t.spec_opts = [''--options'', "\"#{RAILS_ROOT}/spec/spec.opts\""] t.spec_files = FileList["spec/#{sub}/**/*_spec.rb"] end So, yes db:test:prepare is a prereq for each of those, which means in both cases it gets run exactly once. As for those numbers, I''m using the time command, I actually run "time rake spec" and after the spec it gives me something that looks like : real 4m16.242s user 3m54.037s sys 0m9.008s -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/rspec-users/attachments/20090128/af2ea57d/attachment-0001.html>