Message328187
Well, I found another mystery. Calling tuple.__getitem__ directly, on an actual tuple instance, is 50-80% slower than calling list.__getitem__ even though in theory, they should be virtually identical with maybe tuple access being infinitesimally be faster.
The only difference I found here between the two __getitem__s surprisingly is that tuple *doesn't* have __getitem__ in its method list, while list does.
>>> [].__getitem__
<built-in method __getitem__ of list object at 0x012EE2D8>
>>> ().__getitem__
<method-wrapper '__getitem__' of tuple object at 0x00130030>
Since list is using the wrapper in tp_methods and tuple isn't, it *look* like METH_COEXIST *is* helping but since we know that in both the dict case and now the tuple/list case it is unnecessary, there's clearly a bug somewhere causing multiple arg tuple allocs and or arg parsing. Unfortunately, it takes me several hours to "catch up" from CALL_FUNCTION in ceval.c to something like call_method in typeobject.c and I don't have that kind of time at the moment but hopefully someone notices this again. |
|
Date |
User |
Action |
Args |
2018-10-21 04:09:48 | bup | set | recipients:
+ bup, benjamin.peterson |
2018-10-21 04:09:47 | bup | set | messageid: <1540094987.94.0.788709270274.issue34396@psf.upfronthosting.co.za> |
2018-10-21 04:09:47 | bup | link | issue34396 messages |
2018-10-21 04:09:47 | bup | create | |
|