Skip to content

Instantly share code, notes, and snippets.

@justinko
Created June 12, 2014 21:56
Show Gist options
  • Save justinko/5108500bf370f4eea4dd to your computer and use it in GitHub Desktop.
Save justinko/5108500bf370f4eea4dd to your computer and use it in GitHub Desktop.
Ghetto Benchmark Function
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