-
Ensure that you have required gems ('ruby-prof' >= 0.16, 'stackprof')
-
Require
spec_profiling.rb
in yourspec_helper.rb
(or whereever you like) -
To profile the whole suite run:
# Profile with ruby-prof
RUBYPROF=1 rspec ...
# Profile with stackprof
STACKPROF=1 rspec ...
- To profile a separate example mark it with the corresponding tag:
# Profile with StackProf
it "is too slow", :sprof do
...
end
# Profile with RubyProf
it "is too slow", :rprof do
...
end