cpython: 3ab32f7add6e (original) (raw)
Mercurial > cpython
changeset 102781:3ab32f7add6e
Issue #27128: _pickle uses fast call Use _PyObject_FastCall() to avoid the creation of temporary tuple. [#27128]
Victor Stinner victor.stinner@gmail.com | |
---|---|
date | Fri, 19 Aug 2016 18:59:15 +0200 |
parents | 71c22e592a9b |
children | c2af917bde71 |
files | Modules/_pickle.c |
diffstat | 1 files changed, 4 insertions(+), 15 deletions(-)[+] [-] Modules/_pickle.c 19 |
line wrap: on
line diff
--- a/Modules/_pickle.c +++ b/Modules/_pickle.c @@ -345,7 +345,6 @@ static PyObject * _Pickle_FastCall(PyObject *func, PyObject *obj) { PyObject *result;
/* Note: this function used to reuse the argument tuple. This used to give a slight performance boost with older pickle implementations where many @@ -358,13 +357,8 @@ static PyObject * significantly reduced the number of function calls we do. Thus, the benefits became marginal at best. */
- if (arg_tuple == NULL) {
Py_DECREF(obj);[](#l1.16)
return NULL;[](#l1.17)
- }
- PyTuple_SET_ITEM(arg_tuple, 0, obj);
- result = PyObject_Call(func, arg_tuple, NULL);
- Py_CLEAR(arg_tuple);
@@ -1157,9 +1151,7 @@ static Py_ssize_t return -1; if (n == READ_WHOLE_LINE) {
PyObject *empty_tuple = PyTuple_New(0);[](#l1.31)
data = PyObject_Call(self->readline, empty_tuple, NULL);[](#l1.32)
Py_DECREF(empty_tuple);[](#l1.33)
@@ -3956,10 +3948,7 @@ save(PicklerObject *self, PyObject obj, / Check for a reduce method. */ reduce_func = PyObject_GetAttrId(obj, &PyId___reduce_); if (reduce_func != NULL) {
PyObject *empty_tuple = PyTuple_New(0);[](#l1.42)
reduce_value = PyObject_Call(reduce_func, empty_tuple,[](#l1.43)
NULL);[](#l1.44)
Py_DECREF(empty_tuple);[](#l1.45)
reduce_value = _PyObject_FastCall(reduce_func, NULL, 0, NULL);[](#l1.46) }[](#l1.47) else {[](#l1.48) PyErr_Format(st->PicklingError,[](#l1.49)