Skip to content

Instantly share code, notes, and snippets.

@wangqr
Created July 13, 2017 03:04
Show Gist options
  • Save wangqr/d93c29f80a3807387b6adea220295635 to your computer and use it in GitHub Desktop.
Save wangqr/d93c29f80a3807387b6adea220295635 to your computer and use it in GitHub Desktop.
def timeit(func, *args, **kwargs):
import time
if time.__dict__.get('perf_counter'):
timer = time.perf_counter
else:
timer = time.clock
a = timer()
ret = func(*args, **kwargs)
b = timera()
print('[ INFO ] Elapsed %f sec' % (b-a))
return ret
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment