Guest User

Untitled

a guest
Apr 25th, 2018
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.56 KB | None | 0 0
  1. In [1]: def f():
  2. ...: return 1
  3. ...:
  4.  
  5. In [2]: %timeit f()
  6. 73.7 ns ± 1.16 ns per loop (mean ± std. dev. of 7 runs, 10000000 loops each)
  7.  
  8. In [3]: def f():
  9. ...: def g():
  10. ...: return 1
  11. ...: return g()
  12. ...:
  13.  
  14. In [4]: %timeit f()
  15. 217 ns ± 8.76 ns per loop (mean ± std. dev. of 7 runs, 1000000 loops each)
  16.  
  17. In [5]: def f():
  18. ...: class C:
  19. ...: def f(self):
  20. ...: return 1
  21. ...: return C().f()
  22. ...:
  23.  
  24. In [6]: %timeit f()
  25. 8.39 µs ± 94.1 ns per loop (mean ± std. dev. of 7 runs, 100000 loops each)
Add Comment
Please, Sign In to add comment