Skip to content

Commit 829318f

Browse files
l3robotphofl
authored andcommitted
PERF: Increase threashold for using binary search in IndexEngine (pandas-dev#54746)
* Increase threashold for using binary search in IndexEngine * Add an entry to the latest whatsnew * Improve entry in the lastest whatsnew --------- Co-authored-by: Patrick Hoefler <[email protected]>
1 parent 04ff46f commit 829318f

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

doc/source/whatsnew/v2.2.0.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ Deprecations
153153

154154
Performance improvements
155155
~~~~~~~~~~~~~~~~~~~~~~~~
156-
-
156+
- Performance improvement when indexing with more than 4 keys (:issue:`54550`)
157157
-
158158

159159
.. ---------------------------------------------------------------------------

pandas/_libs/index.pyx

+1-1
Original file line numberDiff line numberDiff line change
@@ -375,7 +375,7 @@ cdef class IndexEngine:
375375
# map each starget to its position in the index
376376
if (
377377
stargets and
378-
len(stargets) < 5 and
378+
len(stargets) < (n / (2 * n.bit_length())) and
379379
not na_in_stargets and
380380
self.is_monotonic_increasing
381381
):

0 commit comments

Comments
 (0)