Skip to content

Instantly share code, notes, and snippets.

@yeeguy
Created June 21, 2012 08:27
Show Gist options
  • Save yeeguy/2964584 to your computer and use it in GitHub Desktop.
Save yeeguy/2964584 to your computer and use it in GitHub Desktop.
Faster rspec tests thru dialing down ruby garbage collection
# place in <app root>/spec/support
RSpec.configure do |config|
# from https://gist.github.com/1121972
config.before(:suite) { GC.disable }
config.after(:suite) { GC.enable }
$example_counter = 0
config.after(:each) do
if $example_counter % 4 == 0 # increase 4 for faster tests; beware of seg faults at > 8
GC.enable
GC.start
GC.disable
end
$example_counter += 1
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment