A very cheap fix, based on some of my work here:
Our test suite runs on a debian VM, I played with various knobs to find the fastest way to run our tests, our baseline was 4:57 mins to run all our tests on
1.9.3 - p392
RAILS_ENV=test RUBY_GC_MALLOC_LIMIT=50000000 LD_PRELOAD=/usr/lib/libtcmalloc_minimal.so.0.0.0 bundle exec rspec spec
Takes 3:10 mins. This is a huge gain over our vanilla run of our test suite.
Some stuff my testing revealed:
Debian sucks as a test machine, its just too old/stable. -O3 build was actually slower than the pre-compiled RVM binary. In my ubuntu testing it was always faster. tcmalloc is older, gcc is older and so on. Its just the wrong machine to be running your tests on.
Raising RUBY_GC_MALLOC_LIMIT from 50 megs to 75 megs slows the tests down by a few seconds, similarly dropping it to 25 slows it again. (Keep in mind default is 8)
I totally agree we should clean up our tests and speed up the suite. In fact, since writing we are already 30 or so seconds slower on my dev machine. That said, the super cheap wins by turning on a few turbo switches sure feels good.
Ruby 2.0 would be yet faster, maybe 5-10%, but we would need to switch our entire hosting infrastructure to 2.0, otherwise running tests on such a different environment to prd is just totally risky.