bpo-38588: Optimize list comparison. (GH-17766)

https://github.com/python/cpython/commit/dfef986f12dd92bd6434117bba0db3cbb4e... commit: dfef986f12dd92bd6434117bba0db3cbb4e65243 branch: master author: Inada Naoki <songofacandy@gmail.com> committer: GitHub <noreply@github.com> date: 2019-12-31T10:58:37+09:00 summary: bpo-38588: Optimize list comparison. (GH-17766) Mitigate performance regression of the list comparison caused by 2d5bf56. files: M Objects/listobject.c diff --git a/Objects/listobject.c b/Objects/listobject.c index abe2604573f95..bc8425cae63e1 100644 --- a/Objects/listobject.c +++ b/Objects/listobject.c @@ -2664,6 +2664,9 @@ list_richcompare(PyObject *v, PyObject *w, int op) for (i = 0; i < Py_SIZE(vl) && i < Py_SIZE(wl); i++) { PyObject *vitem = vl->ob_item[i]; PyObject *witem = wl->ob_item[i]; + if (vitem == witem) { + continue; + } Py_INCREF(vitem); Py_INCREF(witem);
participants (1)
-
Inada Naoki