From 1477ac7cde1fd51f8253ccba9c40fe85f3f16235 Mon Sep 17 00:00:00 2001 From: Ryan Bigg Date: Wed, 23 Nov 2011 13:19:54 +1100 Subject: [PATCH] Add gc_hacks that speeds up the tests slightly 70 second improvement (290 -> 220) on my machine --- core/spec/support/gc_hacks.rb | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 core/spec/support/gc_hacks.rb diff --git a/core/spec/support/gc_hacks.rb b/core/spec/support/gc_hacks.rb new file mode 100644 index 00000000000..20604e3021e --- /dev/null +++ b/core/spec/support/gc_hacks.rb @@ -0,0 +1,17 @@ +# From: http://www.rubyinside.com/careful-cutting-to-get-faster-rspec-runs-with-rails-5207.html +counter = -1 +RSpec.configure do |config| + config.after(:each) do + counter += 1 + if counter > 9 + GC.enable + GC.start + GC.disable + counter = 0 + end + end + + config.after(:suite) do + counter = 0 + end +end