Skip to content

Instantly share code, notes, and snippets.

@jelder
Created July 11, 2012 21:43
Show Gist options
  • Save jelder/3093810 to your computer and use it in GitHub Desktop.
Save jelder/3093810 to your computer and use it in GitHub Desktop.
Quick and dirty Ruby benchmark method
#!/usr/bin/env ruby
def benchmark(count)
timing = []
count.times do
start = Time.now
yield
timing << Time.now - start
print "."
end
puts timing.inject(:+).to_f/timing.size
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment