[Today I learned][1] that Ruby garbage collection can be of huge importance to performance. More precisely, if Ruby does a lot of garbage collection it may slow down your code. Running garbage collection only every 10 or 20 seconds when running specs may increase performance dramatically.
At this time specs for Ariejan.net take an average of 25.29s to run. This is not bad, but in my opinion faster specs are better. After tweaking ruby garbage collection I got my specs to run in 19.05s, a **24.6% speed increase**!
The key is that you don't want ruby to decide when to do garbage collection for you. Instead, we'll tell Ruby when to do this, and we'll let it do it every 15 seconds.
To set this up for RSpec create a file `spec/support/deferred_garbage_collection.rb`: