mirror of
https://github.com/Hizenberg469/Python-tutorial.git
synced 2026-04-19 23:12:24 +03:00
17 lines
314 B
Python
17 lines
314 B
Python
from time import time
|
|
|
|
def performance(fn):
|
|
def wrapper(*args, **kwargs):
|
|
t1 = time()
|
|
result = fn(*args, **kwargs)
|
|
t2 = time()
|
|
print(f'took {t2-t1} ms')
|
|
return result
|
|
return wrapper
|
|
|
|
@performance
|
|
def long_time():
|
|
for i in range(1000000):
|
|
i*5
|
|
|
|
long_time() |