From 0452ee3929ea4b30f74941f67d2e889e77a2df91 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89mile=20Robitaille?= Date: Mon, 21 Aug 2023 19:50:48 -0400 Subject: [PATCH 1/3] Increase threashold for using binary search in IndexEngine --- pandas/_libs/index.pyx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandas/_libs/index.pyx b/pandas/_libs/index.pyx index e974b5d0eec46..5c7680bc6fb6c 100644 --- a/pandas/_libs/index.pyx +++ b/pandas/_libs/index.pyx @@ -375,7 +375,7 @@ cdef class IndexEngine: # map each starget to its position in the index if ( stargets and - len(stargets) < 5 and + len(stargets) < (n / (2 * n.bit_length())) and not na_in_stargets and self.is_monotonic_increasing ): From 599d0392294dc6414f84e0fb580eaef7517fb390 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89mile=20Robitaille?= Date: Thu, 24 Aug 2023 22:37:54 -0400 Subject: [PATCH 2/3] Add an entry to the latest whatsnew --- doc/source/whatsnew/v2.2.0.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/source/whatsnew/v2.2.0.rst b/doc/source/whatsnew/v2.2.0.rst index b90563ba43d83..450f0fda556bd 100644 --- a/doc/source/whatsnew/v2.2.0.rst +++ b/doc/source/whatsnew/v2.2.0.rst @@ -105,7 +105,7 @@ Deprecations Performance improvements ~~~~~~~~~~~~~~~~~~~~~~~~ -- +- Increase the threshold to use binary search instead of a linear search in IndexEngine :issue:`54550` - .. --------------------------------------------------------------------------- From 156bd4fe0431ff9c8c722a4d0105fd68b6ec6faf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89mile=20Robitaille?= Date: Fri, 25 Aug 2023 19:41:25 -0400 Subject: [PATCH 3/3] Improve entry in the lastest whatsnew --- doc/source/whatsnew/v2.2.0.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/source/whatsnew/v2.2.0.rst b/doc/source/whatsnew/v2.2.0.rst index 450f0fda556bd..651482789cd6e 100644 --- a/doc/source/whatsnew/v2.2.0.rst +++ b/doc/source/whatsnew/v2.2.0.rst @@ -105,7 +105,7 @@ Deprecations Performance improvements ~~~~~~~~~~~~~~~~~~~~~~~~ -- Increase the threshold to use binary search instead of a linear search in IndexEngine :issue:`54550` +- Performance improvement when indexing with more than 4 keys (:issue:`54550`) - .. ---------------------------------------------------------------------------