98_profiler.py 307 B

123456789101112131415161718192021
  1. import time
  2. def costly_func(n: int):
  3. time.sleep(n) # 2s
  4. time.sleep(1) # 1s
  5. x = 1
  6. y = 2
  7. costly_func(2) # 3s
  8. time.sleep(1) # 1s
  9. def new_func(a, b, c):
  10. x = a + b
  11. x = x + c
  12. return a
  13. def new_func2(a, b, c):
  14. x = a + b
  15. x = x + c
  16. return a