perf: Use a hashmap for full-state filtering

This commit is contained in:
timedout
2026-06-27 20:29:04 +01:00
committed by Jade Ellis
parent 16f5d4b0e2
commit 6ca3acbeff
@@ -1,6 +1,7 @@
use std::{
cmp::max,
collections::{HashMap, hash_map},
collections::{HashMap, HashSet, hash_map},
hash::{BuildHasherDefault, DefaultHasher},
time::{Duration, Instant},
};
@@ -136,7 +137,8 @@ pub(super) async fn fetch_state(
// arbitrary state injection.
// Atomic fetch does not have this problem as each PDU is evaluated
// individually.
let expected = &res.pdu_ids;
let expected: &HashSet<OwnedEventId, BuildHasherDefault<DefaultHasher>> =
&HashSet::from_iter(res.pdu_ids.clone());
state
.into_iter()
.stream()