New submission from STINNER Victor:

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.

----------
files: decimal.patch
keywords: patch
messages: 285665
nosy: haypo, skrah
priority: normal
severity: normal
status: open
title: decimal: Use FASTCALL and/or Argument Clinic
type: performance
versions: Python 3.7
Added file: http://bugs.python.org/file46320/decimal.patch

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue29301>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to