Skip to content

Instantly share code, notes, and snippets.

@hackjoy
Created January 21, 2013 22:52
Show Gist options
  • Save hackjoy/4590269 to your computer and use it in GitHub Desktop.
Save hackjoy/4590269 to your computer and use it in GitHub Desktop.
Calculates time to execute a method
import time
def time_execution(code):
start = time.clock()
result = eval(code)
run_time = time.clock() - start
return result, runtime
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment