Message327317
The common case for bisect calls is to have two positional arguments and no keyword arguments. For this case, PyArg_ParseTupleAndKeywords() is unnecessarily expensive.
Timings
-------
$ pytime -r 11 -s 'from bisect import bisect' -s 'arr=list(range(5))' 'bisect(arr, 2)'
2000000 loops, best of 11: 152 nsec per loop
$ pytime -r 11 -s 'from bisect import bisect' -s 'arr=list(range(5))' 'bisect(arr, 2)'
2000000 loops, best of 11: 152 nsec per loop
$ pytime -r 11 -s 'from bisect import bisect' -s 'arr=list(range(5))' 'bisect(arr, 2)'
2000000 loops, best of 11: 152 nsec per loop
------- patched --------
$ pytime -r 11 -s 'from bisect import bisect' -s 'arr=list(range(5))' 'bisect(arr, 2)'
2000000 loops, best of 11: 112 nsec per loop
$ pytime -r 11 -s 'from bisect import bisect' -s 'arr=list(range(5))' 'bisect(arr, 2)'
2000000 loops, best of 11: 113 nsec per loop
$ pytime -r 11 -s 'from bisect import bisect' -s 'arr=list(range(5))' 'bisect(arr, 2)'
2000000 loops, best of 11: 113 nsec per loop |
|
Date |
User |
Action |
Args |
2018-10-08 03:33:04 | rhettinger | set | recipients:
+ rhettinger |
2018-10-08 03:33:04 | rhettinger | set | messageid: <1538969584.76.0.545547206417.issue34925@psf.upfronthosting.co.za> |
2018-10-08 03:33:04 | rhettinger | link | issue34925 messages |
2018-10-08 03:33:04 | rhettinger | create | |
|