Skip to content

Instantly share code, notes, and snippets.

@allenluce-zz
Created July 23, 2012 22:39
Show Gist options
  • Save allenluce-zz/3166689 to your computer and use it in GitHub Desktop.
Save allenluce-zz/3166689 to your computer and use it in GitHub Desktop.
def timeIt(comment, &code)
retValue = nil
time = Benchmark.realtime do
retValue = code.call
end
puts "#{comment}: %.2fms" % (time*1000)
retValue
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment