Message181753
Indeed the function call cost actually dominates:
$ ./python -m timeit -s "a = 'hundred'" "a.find('x')"
1000000 loops, best of 3: 0.206 usec per loop
$ ./python -m timeit -s "a = 'hundred'; f=a.find" "f('x')"
10000000 loops, best of 3: 0.176 usec per loop
$ ./python -m timeit -s "a = 'hundred'" "'x' in a"
10000000 loops, best of 3: 0.0431 usec per loop |
|
Date |
User |
Action |
Args |
2013-02-09 19:43:53 | pitrou | set | recipients:
+ pitrou, gvanrossum, ezio.melotti, serhiy.storchaka |
2013-02-09 19:43:53 | pitrou | set | messageid: <1360439033.43.0.496471662015.issue17170@psf.upfronthosting.co.za> |
2013-02-09 19:43:53 | pitrou | link | issue17170 messages |
2013-02-09 19:43:53 | pitrou | create | |
|