Created
June 12, 2014 21:56
-
-
Save justinko/5108500bf370f4eea4dd to your computer and use it in GitHub Desktop.
Ghetto Benchmark Function
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'benchmark' | |
def realtime(message = nil, count: 1, &block) | |
results = [] | |
count.times { results << Benchmark.realtime(&block) } | |
puts | |
puts message if message | |
puts results.sum / results.size.to_f | |
puts | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment