Commit a4ff41c4 authored by Tim Peters's avatar Tim Peters

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).
parent 36e58a88
...@@ -213,6 +213,7 @@ Joerg-Cyril Hoehle ...@@ -213,6 +213,7 @@ Joerg-Cyril Hoehle
Gregor Hoffleit Gregor Hoffleit
Chris Hoffman Chris Hoffman
Albert Hofkamp Albert Hofkamp
Jonathan Hogg
Gerrit Holl Gerrit Holl
Philip Homburg Philip Homburg
Naofumi Honda Naofumi Honda
......
...@@ -780,7 +780,7 @@ docompare(PyObject *x, PyObject *y, PyObject *compare) ...@@ -780,7 +780,7 @@ docompare(PyObject *x, PyObject *y, PyObject *compare)
Py_INCREF(y); Py_INCREF(y);
PyTuple_SET_ITEM(args, 0, x); PyTuple_SET_ITEM(args, 0, x);
PyTuple_SET_ITEM(args, 1, y); PyTuple_SET_ITEM(args, 1, y);
res = PyEval_CallObject(compare, args); res = PyObject_Call(compare, args, NULL);
Py_DECREF(args); Py_DECREF(args);
if (res == NULL) if (res == NULL)
return CMPERROR; return CMPERROR;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment