Created
January 21, 2013 22:52
-
-
Save hackjoy/4590269 to your computer and use it in GitHub Desktop.
Calculates time to execute a method
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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