aoc2020/aoclib/performance.py
2020-12-05 12:16:30 +01:00

14 lines
341 B
Python

import time
def print_execution_time(func):
def wrapper(*args, **kwargs):
time_start = time.time()
return_value = func(*args, **kwargs)
time_stop = time.time()
print('{:s} function took {:.3f}ms'.format(func.__name__, (time_stop - time_start) * 1000.0))
return return_value
return wrapper