Changes

Jump to navigation Jump to search
321 bytes added ,  08:44, 14 February 2022
Created page with "== Timeit decorator == <syntaxhighlight lang="python3"> import time def timeit(method): def timed(*args, **kw): ts = time.time() result = method(*args, **..."
== Timeit decorator ==
<syntaxhighlight lang="python3">
import time

def timeit(method):
def timed(*args, **kw):
ts = time.time()
result = method(*args, **kw)
te = time.time()

print(f'{method.__name__} {(te - ts) * 1000} ms')
return result
return timed
</syntaxhighlight>

Navigation menu