Message285665
I'm currently working on the isuse #29259: "Add tp_fastcall to PyTypeObject: support FASTCALL calling convention for all callable objects". I used bm_telco of the performance benchmark suite to check which functions still require to create a temporary tuple for positional arguments and a temporary dict for keyword arguments. I found 3 remaining functions which have an impact on the result of the benchmark:
* print(): optimized by the issue #29296
* _struct.unpack(): I just created the issue #29300 "Modify the _struct module to use FASTCALL and Argument Clinic"
* _decimal.Decimal.quantize()
I would like to know if Stephan would be ok to modify the _decimal module to use FASTCALL. I know that recently he reverted changes to keep the same code base on Python 3.5, 3.6 and 3.7.
With 4 changes (tp_fastcall #29259, print #29296, unpack #29300 and this issue), bm_telco becomes 22% faster which is not negligible!
20.9 ms +- 0.5 ms => 16.4 ms +- 0.5 ms
Attached decimal.patch patch is the strict minimum change to optimize bm_telco, but I would prefer to change all _decimal functions and methods using METH_VARARGS and METH_VARARGS|METH_KEYWORDS to convert them to METH_FASTCALL.
The best would be to use Argument Clinic. AC exists since Python 3.5, so it should be possible to keep the same code base on Python 3.5-3.7, only generated code would be different. |
|
Date |
User |
Action |
Args |
2017-01-17 16:38:44 | vstinner | set | recipients:
+ vstinner, skrah |
2017-01-17 16:38:44 | vstinner | set | messageid: <1484671124.21.0.493200110844.issue29301@psf.upfronthosting.co.za> |
2017-01-17 16:38:44 | vstinner | link | issue29301 messages |
2017-01-17 16:38:44 | vstinner | create | |
|