This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author bup
Recipients benjamin.peterson, bup
Date 2018-10-21.04:09:46
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1540094987.94.0.788709270274.issue34396@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2018-10-21 04:09:48bupsetrecipients: + bup, benjamin.peterson
2018-10-21 04:09:47bupsetmessageid: <1540094987.94.0.788709270274.issue34396@psf.upfronthosting.co.za>
2018-10-21 04:09:47buplinkissue34396 messages
2018-10-21 04:09:47bupcreate