Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
require 'benchmark'
def time(times = 1)
unless block_given?
puts "No block provided"
return
end
ret = nil
Benchmark.bm do |x|
x.report { times.times { ret = yield } }
end
ret
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.