From 207915e5110897cda309f4bc6f5d8ad2ce6a5f35 Mon Sep 17 00:00:00 2001 From: Adam Gutglick Date: Tue, 2 Jun 2026 19:55:56 +0100 Subject: [PATCH] Try a trick from std Signed-off-by: Adam Gutglick --- vortex-array/src/search_sorted.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vortex-array/src/search_sorted.rs b/vortex-array/src/search_sorted.rs index 14741652330..f3514708aec 100644 --- a/vortex-array/src/search_sorted.rs +++ b/vortex-array/src/search_sorted.rs @@ -237,7 +237,7 @@ fn search_sorted_side_idx VortexResult>( // Binary search interacts poorly with branch prediction, so force // the compiler to use conditional moves if supported by the target // architecture. - base = if cmp == Greater { base } else { mid }; + base = hint::select_unpredictable(cmp == Greater, base, mid); // This is imprecise in the case where `size` is odd and the // comparison returns Greater: the mid element still gets included