Created
June 21, 2012 08:27
-
-
Save yeeguy/2964584 to your computer and use it in GitHub Desktop.
Faster rspec tests thru dialing down ruby garbage collection
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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