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 Demur Rumed, Mark.Shannon, serhiy.storchaka, vstinner
Date 2016-08-25.22:27:13
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1472164033.37.0.412705486879.issue27213@psf.upfronthosting.co.za>
In-reply-to
Content
I'm working on a new calling convention: "fast call".

I already pushed changes implementing first functions:

_PyObject_FastCallDict(PyObject *func, PyObject **stack, Py_ssize_t nargs, PyObject *kwargs)

kwargs is a Python dict, but it can be NULL.

_PyObject_FastCallDict() avoids the creation a temporary tuple when you don't have to pass keyword arguments.

But I'm interested by an evolution to avoid also the creation of a temporary dictionary: issue #27830, "Add _PyObject_FastCallKeywords(): avoid the creation of a temporary dictionary for keyword arguments". This function would be the fundation for a new calling convention for C functions: #27810, "Add METH_FASTCALL: new calling convention for C functions".

I didn't read your patch carefully, but I would like to make sure that your patch would benefit of these APIs to avoid the creation of temporary tuple and/or dict.

"func(*args, key=value)" uses CALL_FUNCTION_EX and so requires to create a temporary dictionary. Maybe it's ok, I don't think that this syntax is commonly used.

"func(*args)" uses CALL_FUNCTION_EX: if args is a tuple, can you confirm that it would be possible to use _PyObject_FastCallDict() and/or _PyObject_FastCallKeywords() to avoid the creation a new temporary tuple?

Hum, I don't think that "func(*args)" can be optimized if args is a list because a list is mutable, we cannot use a direct access to the internal C array of a list.
History
Date User Action Args
2016-08-25 22:27:13vstinnersetrecipients: + vstinner, Mark.Shannon, serhiy.storchaka, Demur Rumed
2016-08-25 22:27:13vstinnersetmessageid: <1472164033.37.0.412705486879.issue27213@psf.upfronthosting.co.za>
2016-08-25 22:27:13vstinnerlinkissue27213 messages
2016-08-25 22:27:13vstinnercreate