From 6db389a0a7800c1a193dd2b983280a15c8319fcf Mon Sep 17 00:00:00 2001 From: Aria Shrimpton Date: Fri, 8 Mar 2024 17:35:02 +0000 Subject: use binary search in sorteduniquevec::remove --- src/crates/library/src/sorted_unique_vector.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/crates/library/src/sorted_unique_vector.rs b/src/crates/library/src/sorted_unique_vector.rs index 5cb0099..ffba865 100644 --- a/src/crates/library/src/sorted_unique_vector.rs +++ b/src/crates/library/src/sorted_unique_vector.rs @@ -147,8 +147,7 @@ impl Container for SortedUniqueVec { (define (post-remove xs r) (equal? r (op-remove xs))) *ENDLIBSPEC*/ fn remove(&mut self, elt: T) -> Option { - let idx = self.iter().position(|x| *x == elt)?; - Some(self.v.remove(idx)) + self.v.remove(self.binary_search(elt).ok()?) } fn iter<'a>(&'a self) -> impl Iterator -- cgit v1.2.3