import time
from functools import lru_cache
@lru_cache(maxsize=5) #It will reduce the time size of the function
def some(n):
time.sleep(n)
return n
if __name__ == '__main__':
t1 = time.time()
some(4)
print("Om")
some(4)
print("ok")
t2 = time.time()
print(t2-t1)
Comments
Post a Comment