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 vstinner
Recipients serhiy.storchaka, vstinner
Date 2016-11-30.11:32:46
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1480505567.26.0.13388381207.issue28839@psf.upfronthosting.co.za>
In-reply-to
Content
Attached patch is a minor optimization for _PyFunction_FastCallDict(): avoid the creation of a tuple to pass keyword arguments, use a simple C array allocated by PyMem_Malloc().

It also uses a small stack of 80 bytes (2*5*sizeof(PyObject*)) allocated on the C stack to pass up to 5 keyword arguments (5 key+value pairs): it avoids completely the allocation on the heap memory 

I wrote _PyFunction_FastCallDict() (issue #27809): the code was based on function_call() which also uses PyTuple_New(). When I wrote the function, I didn't notice that PyEval_EvalCodeEx() doesn't expect a Python tuple object, but a C array.

The patch also modifies function_call() to call _PyFunction_FastCallDict(), so it gets _PyFunction_FastCallDict() optimizations.
History
Date User Action Args
2016-11-30 11:32:47vstinnersetrecipients: + vstinner, serhiy.storchaka
2016-11-30 11:32:47vstinnersetmessageid: <1480505567.26.0.13388381207.issue28839@psf.upfronthosting.co.za>
2016-11-30 11:32:47vstinnerlinkissue28839 messages
2016-11-30 11:32:47vstinnercreate