Tuesday, May 08, 2012

Speeding up RSpec

So today I have been looking into getting our enormous battery of tests to run faster. I have yet to find anything that works for Cucumber, but I did find an interesting way to speed up RSpec which is detailed here.


Basically, it seems that by not collecting garbage too frequently, you can make your tests run much faster (at the expense of memory management of course). We observed a 30% reduction in the time it takes to run an RSpec test suite.

I did try to implement this on Cucumber, however because we need to store much more in memory to set up and tear down our objects, it meant that I kept running out of memory when I wasn't using the default Garbage Collection and the tests took even longer (so, buyer beware). I suppose if you had a small set of features though you might see some benefit.


Anonymous said...

I ran across your blog originally looking for information on caching JSON in rails apps (I've run into the same missing ".json" bug myself).

Then I encountered this post. I'm one of the founders of Tddium -- a hosted test and CI server that automatically accelerates large rspec, cucumber, and test-unit test suites by running them in parallel in our high-performance cloud. You can use our distributed platform both with our own CI server or with your existing Jenkins/Teamcity/etc setup. Come check it out for free -- www.tddium.com.

Anonymous said...

For cucumber, this worked for me: