Faster specs
Add to Gemfile into test and development groups:
gem 'perftools.rb', require: 'perftools'
From the command line:
$ time CPUPROFILE=~/tmp/prof CPUPROFILE_REALTIME=1 rspec
$ pprof.rb --text ~/tmp/prof | head -10
In spec_helper.rb add:
# Quick hack to see what our peak number of objects on the heap is
heap_live_num = 0
config.after(:each) do
heap_live_num = [heap_live_num, GC.stat[:heap_live_num]].max
end
config.after(:suite) do
puts "\n\nMAX HEAP OBJECT COUNT: #{heap_live_num}"
end
Based on the previous value adjust:
export RUBY_HEAP_MIN_SLOTS=1500000
export RUBY_HEAP_FREE_MIN=20000
export RUBY_GC_MALLOC_LIMIT=100000000
Note: you can put them into your .bashrc
Credits
Written by Posăceanu Marian
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Ruby
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#