feat: Prefer binary to exponential search

This commit is contained in:
Clément Renault 2019-02-16 16:52:56 +01:00
parent a8df438814
commit 6393b0cbc0
No known key found for this signature in database
GPG Key ID: 0151CDAB43460DAE

View File

@ -131,7 +131,7 @@ fn merge_ranked_maps(existing: Option<&[u8]>, operands: &mut MergeOperands) -> V
let mut ranked_map = RankedMap::default();
for bytes in existing.into_iter().chain(operands) {
match ReadRankedMapEvent::from_bytes(bytes.to_vec()).unwrap() {
RemovedDocuments(d) => ranked_map.retain(|(k, _), _| !d.as_ref().contains(k)),
RemovedDocuments(d) => ranked_map.retain(|(k, _), _| !d.as_ref().binary_search(k).is_ok()),
UpdatedDocuments(i) => ranked_map.extend(i),
}
}