Author rhettinger
Recipients rhettinger
Date 2018-10-08.03:33:04
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1538969584.76.0.545547206417.issue34925@psf.upfronthosting.co.za>
In-reply-to
Content
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
History
Date User Action Args
2018-10-08 03:33:04rhettingersetrecipients: + rhettinger
2018-10-08 03:33:04rhettingersetmessageid: <1538969584.76.0.545547206417.issue34925@psf.upfronthosting.co.za>
2018-10-08 03:33:04rhettingerlinkissue34925 messages
2018-10-08 03:33:04rhettingercreate