19 January 2012

A very cursory test of RSpec 2.8 speed

As You may know the RSpec 2.8 has been released. One of the main improvements, as many people have already confirmed, is speed.
Here I want to make real quick and dirty test how much faster the new RSpec release is.
The truth is that rather comparing RSpec 2.8 vs 2.7 I would like to compare whole set of testing tools I use.
Now, I would like to excuse myself.
I didn't prepare this test environment at all. This is simply just because of coincident, that I have two branches of the same application with different testing tool sets.
Therefore, the following RSpec tests results are made with a little help of FactoryGirl and DatabaseCleaner, and the minitest tests run with good old-fashioned fixtures. These can have a bad influence on following tests results. Also, I have a very small test suite here only to pass through. Don't expect full scientific approach, so.
But the good thing here is that the results I got, seems to be following the senses;)

Rspec-2.7
rafal@raw-laptop:~/Development/wir$ bundle exec rspec spec/models/user_spec.rb
.........
Finished in 8.49 seconds
9 examples, 0 failures

Not too good as for small test suite, but nobody expects more from feature-overloaded rspec.

Rspec-2.8
rafal@raw-laptop:~/Development/wir$ bundle exec rspec spec/models/user_spec.rb
.........
Finished in 0.94543 seconds 
9 examples, 0 failures

This is a big WOW! here. This is almost 9 times faster - good job! How did they do this? Did they reimplement the whole stuff?;)

But...

MiniTest
rafal@raw-laptop:~/Development/wir$ bundle exec ruby -Itest test/models/user_test.rb 
Run options: --seed 29468
# Running tests:
.........
Finished tests in 0.307684s, 29.2508 tests/s, 52.0015 assertions/s.
9 tests, 16 assertions, 0 failures, 0 errors, 0 skips

So...
As we can see here, the minitest toolset is still the speed leader. But the difference between RSpec is not so knocking out, as it was before.
I personally prefer minitest and enjoy using its spec syntax, which IMHO is much better than RSpec approach is. Minitest DSL is humanized just enough to be readable and also still to stay looking like a programming language.
I must say, I am also happy about positive influence that minitest has on other tools.
A competition is always good.
I bet RSpec developers got a lesson from minitest. I think, not only the increase of speed, but some new features, like e.g. random tests order, come from minitest.
And I think this is good. And don't forget, we have all of those because we do open source:)

No comments:

Post a Comment