Skip to content

Instantly share code, notes, and snippets.

@scarfacedeb
Created October 28, 2013 01:38
Show Gist options
  • Save scarfacedeb/7190139 to your computer and use it in GitHub Desktop.
Save scarfacedeb/7190139 to your computer and use it in GitHub Desktop.
Helper to measure execution time
# Author: Ryan Bates
# see: https://github.com/railscasts/137-memoization-revised/blob/master/store-after/app/helpers/application_helper.rb
def report_time(code)
start = Time.now
result = eval(code)
finish = Time.now
render "report", code: code, result: result, time: finish - start
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment