Message294750
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. |
|
Date |
User |
Action |
Args |
2017-05-30 11:05:34 | vstinner | set | recipients:
+ vstinner, pitrou, serhiy.storchaka |
2017-05-30 11:05:34 | vstinner | set | messageid: <1496142334.89.0.16143099629.issue30509@psf.upfronthosting.co.za> |
2017-05-30 11:05:34 | vstinner | link | issue30509 messages |
2017-05-30 11:05:34 | vstinner | create | |
|