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 serhiy.storchaka
Recipients pitrou, serhiy.storchaka, vstinner
Date 2017-05-30.05:56:37
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1496123800.73.0.877253409287.issue30509@psf.upfronthosting.co.za>
In-reply-to
Content
In excellent Peter Cawley's article "Why are slots so slow?" [1] analysed causes why `a + b` is slower than `a.__add__(b)` for custom __add__ and provided suggestions for optimizing type slot calls. `a + b` and `a.__add__(b)` execute the same user code, `a + b` should have smaller overhead of bytecode interpreting, but it was 2 times slower than  `a.__add__(b)`. In the article `a + b` has been made 16% faster than `a.__add__(b)`.

In 3.7 the difference between two ways is smaller, but `a + b` still is 25-30% slower than `a.__add__(b)`. 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 proposed patch tweaks the code and makes `a + b` only 12% slower than `a.__add__(b)`. There is similar effect for other type slot calls.

[1] https://www.corsix.org/content/why-are-slots-so-slow
History
Date User Action Args
2017-05-30 05:56:42serhiy.storchakasetrecipients: + serhiy.storchaka, pitrou, vstinner
2017-05-30 05:56:40serhiy.storchakasetmessageid: <1496123800.73.0.877253409287.issue30509@psf.upfronthosting.co.za>
2017-05-30 05:56:40serhiy.storchakalinkissue30509 messages
2017-05-30 05:56:40serhiy.storchakacreate