Message294739
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 |
|
Date |
User |
Action |
Args |
2017-05-30 05:56:42 | serhiy.storchaka | set | recipients:
+ serhiy.storchaka, pitrou, vstinner |
2017-05-30 05:56:40 | serhiy.storchaka | set | messageid: <1496123800.73.0.877253409287.issue30509@psf.upfronthosting.co.za> |
2017-05-30 05:56:40 | serhiy.storchaka | link | issue30509 messages |
2017-05-30 05:56:40 | serhiy.storchaka | create | |
|