From 95ab879f20ef876f5c27e5ed9ec0f0840b34eec1 Mon Sep 17 00:00:00 2001 From: Egor Dranischnikow Date: Mon, 21 Jun 2021 15:07:31 +0200 Subject: [PATCH 1/2] adding perf regression example --- asv_bench/benchmarks/algos/isin.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/asv_bench/benchmarks/algos/isin.py b/asv_bench/benchmarks/algos/isin.py index 296101c9f9800..427af9307f2c9 100644 --- a/asv_bench/benchmarks/algos/isin.py +++ b/asv_bench/benchmarks/algos/isin.py @@ -325,3 +325,13 @@ def setup(self, dtype, series_type): def time_isin(self, dtypes, series_type): self.series.isin(self.values) + + +class IsInWithLongTupples: + def setup(self): + t = tuple(range(1000)) + self.series = Series([t] * 1000) + self.values = [t] + + def time_isin(self): + self.series.isin(self.values) From b828551540fe548fdac62a9a4054832987af2efb Mon Sep 17 00:00:00 2001 From: Egor Dranischnikow Date: Mon, 21 Jun 2021 15:10:33 +0200 Subject: [PATCH 2/2] the same object is always equal --- pandas/_libs/src/klib/khash_python.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pandas/_libs/src/klib/khash_python.h b/pandas/_libs/src/klib/khash_python.h index c8e1ca5ebb4d3..4d7875be7e5fd 100644 --- a/pandas/_libs/src/klib/khash_python.h +++ b/pandas/_libs/src/klib/khash_python.h @@ -226,6 +226,9 @@ int PANDAS_INLINE tupleobject_cmp(PyTupleObject* a, PyTupleObject* b){ int PANDAS_INLINE pyobject_cmp(PyObject* a, PyObject* b) { + if (a == b) { + return 1; + } if (Py_TYPE(a) == Py_TYPE(b)) { // special handling for some built-in types which could have NaNs // as we would like to have them equivalent, but the usual