diff options
author | Inada Naoki <songofacandy@gmail.com> | 2019-12-31 01:58:37 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-12-31 01:58:37 (GMT) |
commit | dfef986f12dd92bd6434117bba0db3cbb4e65243 (patch) | |
tree | f4cea7b45fd26210bf9fdfd1b01effab5212097a | |
parent | 2d5bf568eaa5059402ccce9ba5a366986ba27c8a (diff) | |
download | cpython-dfef986f12dd92bd6434117bba0db3cbb4e65243.zip cpython-dfef986f12dd92bd6434117bba0db3cbb4e65243.tar.gz cpython-dfef986f12dd92bd6434117bba0db3cbb4e65243.tar.bz2 |
bpo-38588: Optimize list comparison. (GH-17766)
Mitigate performance regression of the list comparison caused by 2d5bf56.
-rw-r--r-- | Objects/listobject.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/Objects/listobject.c b/Objects/listobject.c index abe2604..bc8425c 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); |