Message362566
The following tiny change:
diff --git a/Objects/listobject.c b/Objects/listobject.c
index 3c39c6444b..3ac03b71d0 100644
--- a/Objects/listobject.c
+++ b/Objects/listobject.c
@@ -2643,8 +2643,7 @@ list_richcompare(PyObject *v, PyObject *w, int op)
Py_INCREF(vitem);
Py_INCREF(witem);
- int k = PyObject_RichCompareBool(vl->ob_item[i],
- wl->ob_item[i], Py_EQ);
+ int k = PyObject_RichCompareBool(vitem, witem, Py_EQ);
Py_DECREF(vitem);
Py_DECREF(witem);
if (k < 0)
Creates the following performance improvement:
Before:
> .\python.bat -m timeit -s "A = list(range(10**7)); B = list(range(10**7))" "A==B"
2 loops, best of 5: 134 msec per loop
> .\python.bat -m timeit -s "A = list(range(10**7)); B = list(range(10**7))" "A==B"
2 loops, best of 5: 134 msec per loop
After:
> .\python.bat -m timeit -s "A = list(range(10**7)); B = list(range(10**7))" "A==B"
2 loops, best of 5: 126 msec per loop
> .\python.bat -m timeit -s "A = list(range(10**7)); B = list(range(10**7))" "A==B"
2 loops, best of 5: 126 msec per loop |
|
Date |
User |
Action |
Args |
2020-02-24 04:56:41 | Dennis Sweeney | set | recipients:
+ Dennis Sweeney |
2020-02-24 04:56:41 | Dennis Sweeney | set | messageid: <1582520201.72.0.954951125447.issue39737@roundup.psfhosted.org> |
2020-02-24 04:56:41 | Dennis Sweeney | link | issue39737 messages |
2020-02-24 04:56:41 | Dennis Sweeney | create | |
|