Skip to content

Instantly share code, notes, and snippets.

@michaelphines
Created May 23, 2012 16:32
Show Gist options
  • Save michaelphines/2776238 to your computer and use it in GitHub Desktop.
Save michaelphines/2776238 to your computer and use it in GitHub Desktop.
Ruby Profiling Code
def profile(times=10)
start = Time.now
times.times { yield }
total = (Time.now-start)*1000
puts "Avg: #{total/times} ms"
puts "Total: #{total} ms"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment