Message282079
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. |
|
Date |
User |
Action |
Args |
2016-11-30 11:32:47 | vstinner | set | recipients:
+ vstinner, serhiy.storchaka |
2016-11-30 11:32:47 | vstinner | set | messageid: <1480505567.26.0.13388381207.issue28839@psf.upfronthosting.co.za> |
2016-11-30 11:32:47 | vstinner | link | issue28839 messages |
2016-11-30 11:32:47 | vstinner | create | |
|