From: Tim Peters Date: Mon, 15 Jul 2002 05:16:13 +0000 (+0000) Subject: docompare(): Another reasonable optimization from Jonathan Hogg for the X-Git-Tag: v2.3c1~5008 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=58cf361e35ba64f51b30e75737720bc73c7f6f2e;p=python docompare(): Another reasonable optimization from Jonathan Hogg for the explicit comparison function case: use PyObject_Call instead of PyEval_CallObject. Same thing in context, but gives a 2.4% overall speedup when sorting a list of ints via list.sort(__builtin__.cmp). --- diff --git a/Misc/ACKS b/Misc/ACKS index 4ecc56f77d..5a4501e3f4 100644 --- a/Misc/ACKS +++ b/Misc/ACKS @@ -213,6 +213,7 @@ Joerg-Cyril Hoehle Gregor Hoffleit Chris Hoffman Albert Hofkamp +Jonathan Hogg Gerrit Holl Philip Homburg Naofumi Honda diff --git a/Objects/listobject.c b/Objects/listobject.c index dd2d5806dd..4825e9b0b9 100644 --- a/Objects/listobject.c +++ b/Objects/listobject.c @@ -780,7 +780,7 @@ docompare(PyObject *x, PyObject *y, PyObject *compare) Py_INCREF(y); PyTuple_SET_ITEM(args, 0, x); PyTuple_SET_ITEM(args, 1, y); - res = PyEval_CallObject(compare, args); + res = PyObject_Call(compare, args, NULL); Py_DECREF(args); if (res == NULL) return CMPERROR;