Created
March 14, 2019 13:28
-
-
Save gerritgr/e6488b366194ee1f5f01b8cfdebe97b2 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
def timeit(method): | |
import time | |
def timed(*args, **kw): | |
start = time.time() | |
print('start method: '+method.__name__ ) | |
result = method(*args, **kw) | |
end = time.time() | |
diff = int(end - start) | |
print('end method: ' + method.__name__,' elapsed: '+str(diff)+'sec') | |
return result | |
return timed | |
@timeit | |
def test_timeit(x=None): | |
import time | |
print('something') | |
time.sleep(4) | |
print('some other thing') | |
return None | |
test_timeit() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment