Advertisement
Guest User

Untitled

a guest
May 19th, 2019
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.87 KB | None | 0 0
  1. Python 3.7.3 (default, Mar 29 2019, 12:10:46)
  2. Type 'copyright', 'credits' or 'license' for more information
  3. IPython 7.5.0 -- An enhanced Interactive Python. Type '?' for help.
  4.  
  5. In [1]: class C:
  6. ...: def m(self): return 1
  7. ...: @classmethod
  8. ...: def c(cls): return 1
  9. ...: @staticmethod
  10. ...: def s(): return 1
  11. ...:
  12.  
  13. In [2]: c = C()
  14.  
  15. In [3]: %timeit c.m()
  16. 64.9 ns ± 0.354 ns per loop (mean ± std. dev. of 7 runs, 10000000 loops each)
  17.  
  18. In [4]: %timeit c.c()
  19. 76.5 ns ± 1.34 ns per loop (mean ± std. dev. of 7 runs, 10000000 loops each)
  20.  
  21. In [5]: %timeit c.s()
  22. 67.4 ns ± 0.456 ns per loop (mean ± std. dev. of 7 runs, 10000000 loops each)
  23.  
  24. In [6]: %timeit C.c()
  25. 82.1 ns ± 1.62 ns per loop (mean ± std. dev. of 7 runs, 10000000 loops each)
  26.  
  27. In [7]: %timeit C.s()
  28. 71.9 ns ± 0.268 ns per loop (mean ± std. dev. of 7 runs, 10000000 loops each)
  29.  
  30. In [8]:
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement