| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
| |
* Move all functions to call objects in a new Objects/call.c file.
* Rename fast_function() to _PyFunction_FastCallKeywords().
* Copy null_error() from Objects/abstract.c
* Inline type_error() in call.c to not have to copy it, it was only
called once.
* Export _PyEval_EvalCodeWithName() since it is now called
from call.c.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Issue #29507: Optimize slots calling Python methods. For Python methods, get
the unbound Python function and prepend arguments with self, rather than
calling the descriptor which creates a temporary PyMethodObject.
Add a new _PyObject_FastCall_Prepend() function used to call the unbound Python
method with self. It avoids the creation of a temporary tuple to pass
positional arguments.
Avoiding temporary PyMethodObject and avoiding temporary tuple makes Python
slots up to 1.46x faster. Microbenchmark on a __getitem__() method implemented
in Python:
Median +- std dev: 121 ns +- 5 ns -> 82.8 ns +- 1.0 ns: 1.46x faster (-31%)
Co-Authored-by: INADA Naoki <songofacandy@gmail.com>
|
|
|
|
| |
_PyArg_NoPositional() now are macros.
|
|\
| |
| |
| | |
using PySlice_GetIndicesEx() in debug builds.
|
| |\
| | |
| | |
| | | |
using PySlice_GetIndicesEx() in debug builds.
|
| | |
| | |
| | |
| | | |
using PySlice_GetIndicesEx() in debug builds.
|
| | |
| | |
| | |
| | | |
Calling builtin method is at most 10% faster.
|
|\ \ \
| |/ /
| | |
| | |
| | |
| | | |
a macro if Py_LIMITED_API is not set or set to the value between 0x03050400
and 0x03060000 (not including) or 0x03060100 or higher. Added functions
PySlice_Unpack() and PySlice_AdjustIndices().
|
| |\ \
| | |/
| | |
| | |
| | | |
Py_LIMITED_API is not set or set to the value between 0x03050400
and 0x03060000 (not including) or 0x03060100 or higher.
|
| | |
| | |
| | |
| | |
| | | |
Py_LIMITED_API is not set or set to the value between 0x03050400
and 0x03060000 (not including) or 0x03060100 or higher.
|
|\ \ \
| |/ /
| | |
| | |
| | |
| | |
| | | |
PyArg_VaParse() and PyArg_VaParseTupleAndKeywords() were not available in
limited API. PyArg_ValidateKeywordArguments(), PyArg_UnpackTuple() and
Py_BuildValue() were not available in limited API of version < 3.3 when
PY_SSIZE_T_CLEAN is defined.
|
| |\ \
| | |/
| | |
| | |
| | |
| | |
| | | |
PyArg_VaParse() and PyArg_VaParseTupleAndKeywords() were not available in
limited API. PyArg_ValidateKeywordArguments(), PyArg_UnpackTuple() and
Py_BuildValue() were not available in limited API of version < 3.3 when
PY_SSIZE_T_CLEAN is defined.
|
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
PyArg_VaParse() and PyArg_VaParseTupleAndKeywords() were not available in
limited API. PyArg_ValidateKeywordArguments(), PyArg_UnpackTuple() and
Py_BuildValue() were not available in limited API of version < 3.3 when
PY_SSIZE_T_CLEAN is defined.
|
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
It got messed up when I merged my private 3.5.3 release
changes with new work happening in the 3.5 main branch.
(3.5 main branch was in "3.5.3rc1", my branch was "3.5.3+",
and Mercurial helpfully merged the two in a kind of nonsense way.)
|
| | |\ |
|
| | | | |
|
| | | | |
|
| | | |
| | | |
| | | |
| | | |
| | | | |
Remove two assertions which can fail on legit code. Keyword arguments are
checked later with better tests and raise a regular (TypeError) exception.
|
| | | |
| | | |
| | | |
| | | | |
possible but Coccinelle couldn't find opportunity.
|
| | | |
| | | |
| | | |
| | | | |
is now of type "const char *" rather of "char *".
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
Issue #29259, #29263. methoddescr_call() creates a PyCFunction object, call it
and the destroy it. Add a new _PyMethodDef_RawFastCallDict() method to avoid
the temporary PyCFunction object.
|
| | | |
| | | |
| | | |
| | | | |
Issue #29259.
|
| | | |
| | | |
| | | |
| | | | |
Issue #29286.
|
| | | |
| | | |
| | | |
| | | |
| | | | |
Issue #29286. Change _PyStack_UnpackDict() prototype to be able to notify of
failure when args is NULL.
|
| | | |
| | | |
| | | |
| | | |
| | | | |
Issue #29286. Similar to _PyArg_NoKeywords(), but expects a tuple of keyword
names, instead of a dict.
|
| | | |
| | | |
| | | |
| | | |
| | | | |
Issue #29286. Function similar to PyArg_ParseTuple(), but uses a C array of
PyObject* to pass arguments. Don't support the compatibility mode.
|
| | | |
| | | |
| | | |
| | | | |
Issue #29286.
|
| | | | |
|
|\ \ \ \
| |/ / /
| | | |
| | | |
| | | | |
KeyError could be raised when cached function with full cache was
simultaneously called from differen threads with the same uncached arguments.
|
| |\ \ \
| | | |/
| | |/|
| | | |
| | | | |
KeyError could be raised when cached function with full cache was
simultaneously called from differen threads with the same uncached arguments.
|
| | |/
| | |
| | |
| | |
| | | |
KeyError could be raised when cached function with full cache was
simultaneously called from differen threads with the same uncached arguments.
|
| | | |
|
| | | |
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
Issue #29234: Inlining _PyStack_AsTuple() into callers increases their stack
consumption, Disable inlining to optimize the stack consumption.
Add _Py_NO_INLINE: use __attribute__((noinline)) of GCC and Clang.
It reduces the stack consumption, bytes per call, before => after:
test_python_call: 1040 => 976 (-64 B)
test_python_getitem: 976 => 912 (-64 B)
test_python_iterator: 1120 => 1056 (-64 B)
=> total: 3136 => 2944 (- 192 B)
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
Issue #29233: Replace the inefficient _PyObject_VaCallFunctionObjArgs() with
_PyObject_FastCall() in call_method() and call_maybe().
Only a few functions call call_method() and call it with a fixed number of
arguments. Avoid the complex and expensive _PyObject_VaCallFunctionObjArgs()
function, replace it with an array allocated on the stack with the exact number
of argumlents.
It reduces the stack consumption, bytes per call, before => after:
test_python_call: 1168 => 1152 (-16 B)
test_python_getitem: 1344 => 1008 (-336 B)
test_python_iterator: 1568 => 1232 (-336 B)
Remove the _PyObject_VaCallFunctionObjArgs() function which became useless.
Rename it to object_vacall() and make it private.
|
|\ \ \
| |/ / |
|
| | |
| | |
| | |
| | |
| | | |
Fix backward compatibility issue, HAVE_LONG_LONG was defined but empty, whereas
it is defined as 1 in Python 3.5.
|
| | | |
|
|\ \ \
| |/ /
| | |
| | | |
WeakValueDictionary when collecting from another thread.
|
| |\ \
| | |/
| | |
| | | |
WeakValueDictionary when collecting from another thread.
|
| | |
| | |
| | |
| | | |
WeakValueDictionary when collecting from another thread.
|
|\ \ \
| |/ /
| | |
| | |
| | | |
available only when Py_LIMITED_API is set to the PY_VERSION_HEX value of
the minimum Python version supporting this API.
|
| | |
| | |
| | |
| | |
| | | |
available only when Py_LIMITED_API is set to the PY_VERSION_HEX value of
the minimum Python version supporting this API.
|
| | |
| | |
| | |
| | | |
Calling function is up to 5% faster.
|
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
Issue #28838: The documentation is of the Python C API is more complete and
more up to date than this old comment.
Removal suggested by Antoine Pitrou.
|
|\ \ \
| |/ / |
|
| |\ \
| | |/ |
|
| | | |
|
| | |
| | |
| | |
| | | |
collections.namedtuple() now supports tuples with more than 255 elements.
|
| | |
| | |
| | |
| | | |
dict.
|