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 vstinner
Recipients pitrou, serhiy.storchaka, vstinner
Date 2017-05-30.11:05:34
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1496142334.89.0.16143099629.issue30509@psf.upfronthosting.co.za>
In-reply-to
Content
type-slot-calls.diff: Can you please create a pull request?

> `a + b` still is 25-30% slower than `a.__add__(b)`

Hum, can you please post a microbenchmark results to see the effect of the patch?

> After analyzing the article and comparing it with the current code I have found that virtually all proposed optimization steps already applied in 3.7 by Victor! The difference is only in details.

The article has two main points:

* the calling convention of the Python C API requires to create a tuple, and that's expensive
* "a + b" has a complex semantics which requires to check for __radd__, check for issubclass(), etc.

Yeah, it seems like the FASTCALL changes I made in typeobject.c removed the overhead of the temporary tuple. Yury's and Naoki's work on CALL_METHOD also improved performances here on method calls.

I don't think that we can change the semantics, only try to optimize the implementation.
History
Date User Action Args
2017-05-30 11:05:34vstinnersetrecipients: + vstinner, pitrou, serhiy.storchaka
2017-05-30 11:05:34vstinnersetmessageid: <1496142334.89.0.16143099629.issue30509@psf.upfronthosting.co.za>
2017-05-30 11:05:34vstinnerlinkissue30509 messages
2017-05-30 11:05:34vstinnercreate