Skip to content

Instantly share code, notes, and snippets.

@veader
Created March 2, 2012 15:10
Show Gist options
  • Save veader/1959040 to your computer and use it in GitHub Desktop.
Save veader/1959040 to your computer and use it in GitHub Desktop.
context 'Benchmarking' do
setup do
100000.times { |i| Artist.make! }
end
should 'do lots of work' do
require 'benchmark'
Benchmark.bm do |x|
x.report { Artist.random }
x.report { Artist.random(5) }
x.report { Artist.random(rand(1000)) }
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment