Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Python 3.7.3 (default, Mar 29 2019, 12:10:46)
- Type 'copyright', 'credits' or 'license' for more information
- IPython 7.5.0 -- An enhanced Interactive Python. Type '?' for help.
- In [1]: class C:
- ...: def m(self): return 1
- ...: @classmethod
- ...: def c(cls): return 1
- ...: @staticmethod
- ...: def s(): return 1
- ...:
- In [2]: c = C()
- In [3]: %timeit c.m()
- 64.9 ns ± 0.354 ns per loop (mean ± std. dev. of 7 runs, 10000000 loops each)
- In [4]: %timeit c.c()
- 76.5 ns ± 1.34 ns per loop (mean ± std. dev. of 7 runs, 10000000 loops each)
- In [5]: %timeit c.s()
- 67.4 ns ± 0.456 ns per loop (mean ± std. dev. of 7 runs, 10000000 loops each)
- In [6]: %timeit C.c()
- 82.1 ns ± 1.62 ns per loop (mean ± std. dev. of 7 runs, 10000000 loops each)
- In [7]: %timeit C.s()
- 71.9 ns ± 0.268 ns per loop (mean ± std. dev. of 7 runs, 10000000 loops each)
- In [8]:
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement