mirror of
https://github.com/python/cpython.git
synced 2025-11-02 19:12:55 +00:00
Add a second special case to the inline function call code in eval_code2().
If we have a PyCFunction (builtin) and it is METH_VARARGS only, load the args and dispatch to call_cfunction() directly. This provides a small speedup for perhaps the most common function calls -- builtins.
This commit is contained in:
parent
bd3090d4d6
commit
da20fce9c3
1 changed files with 7 additions and 1 deletions
|
|
@ -1969,7 +1969,13 @@ eval_code2(PyCodeObject *co, PyObject *globals, PyObject *locals,
|
||||||
callable object.
|
callable object.
|
||||||
*/
|
*/
|
||||||
if (PyCFunction_Check(func)) {
|
if (PyCFunction_Check(func)) {
|
||||||
if (PyCFunction_GET_FLAGS(func) == 0) {
|
int flags = PyCFunction_GET_FLAGS(func);
|
||||||
|
if (flags == METH_VARARGS) {
|
||||||
|
PyObject *callargs;
|
||||||
|
callargs = load_args(&stack_pointer, na);
|
||||||
|
x = call_cfunction(func, callargs, NULL);
|
||||||
|
Py_XDECREF(callargs);
|
||||||
|
} else if (flags == 0) {
|
||||||
x = fast_cfunction(func,
|
x = fast_cfunction(func,
|
||||||
&stack_pointer, na);
|
&stack_pointer, na);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue