diff --git a/vortex-array/Cargo.toml b/vortex-array/Cargo.toml index f1ed9d4167..3a967319e1 100644 --- a/vortex-array/Cargo.toml +++ b/vortex-array/Cargo.toml @@ -40,3 +40,7 @@ vortex-schema = { path = "../vortex-schema" } [dev-dependencies] criterion = { workspace = true } + +[[bench]] +name = "search_sorted" +harness = false \ No newline at end of file diff --git a/vortex-array/src/compute/search_sorted.rs b/vortex-array/src/compute/search_sorted.rs index 4f8ce32c9f..3022d93354 100644 --- a/vortex-array/src/compute/search_sorted.rs +++ b/vortex-array/src/compute/search_sorted.rs @@ -115,13 +115,6 @@ impl + Len + ?Sized, T> SearchSorted for S { } } -impl IndexOrd for T { - fn index_cmp(&self, idx: usize, elem: &Scalar) -> Option { - let scalar_a = scalar_at(self, idx).ok()?; - scalar_a.partial_cmp(elem) - } -} - impl IndexOrd for &dyn Array { fn index_cmp(&self, idx: usize, elem: &Scalar) -> Option { let scalar_a = scalar_at(*self, idx).ok()?; @@ -131,13 +124,8 @@ impl IndexOrd for &dyn Array { impl IndexOrd for [T] { fn index_cmp(&self, idx: usize, elem: &T) -> Option { - self[idx].partial_cmp(elem) - } -} - -impl Len for T { - fn len(&self) -> usize { - T::len(self) + // SAFETY: Used in search_sorted_by same as the standard library. The search_sorted ensures idx is in bounds + unsafe { self.get_unchecked(idx) }.partial_cmp(elem) } }