Commit 4829dd23 authored by Dos Santos David's avatar Dos Santos David

add util function to time functions

parent 072f7c96
import time
def timeit(text):
def timeit_decorator(method):
def timed(*args, **kw):
ts = time.time()
result = method(*args, **kw)
te = time.time()
print('... {name} {time:2.2f} ms\n'.format(name=text,time=(te-ts)*1000))
return result
return timed
return timeit_decorator
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment