RSpec Profile
RSpec includes an easy way to measure test speed, the -p
(profile) flag. It takes an argument [COUNT]
representing the number of blocks to measure, defaulting to 10.
Here's some sample output:
Top 3 slowest examples (0.03332 seconds, 57.9% of total time):
Developer should have a valid factory
0.0199 seconds ./spec/models/developer_spec.rb:4
Post should have a valid factory
0.00816 seconds ./spec/models/post_spec.rb:4
Post should require a body
0.00525 seconds ./spec/models/post_spec.rb:16
Tweet