From adff8938350120594581c814df1300451459ed0f Mon Sep 17 00:00:00 2001 From: Ivan Enderlin Date: Thu, 13 Jun 2024 16:28:38 +0200 Subject: [PATCH] feat(base): Faster `Store::rooms_filtered`. Just like in https://github.com/matrix-org/matrix-rust-sdk/pull/3552, this patch updates `Store::rooms_filtered` to not call `Store::room` so that it doesn't lock `rooms` for each item, thus making it way faster. --- crates/matrix-sdk-base/src/store/mod.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/matrix-sdk-base/src/store/mod.rs b/crates/matrix-sdk-base/src/store/mod.rs index a8c2f858a5c..5e908e6b39e 100644 --- a/crates/matrix-sdk-base/src/store/mod.rs +++ b/crates/matrix-sdk-base/src/store/mod.rs @@ -213,8 +213,8 @@ impl Store { .read() .unwrap() .iter() - .filter(|(_, r)| filter.matches(r.state())) - .filter_map(|(id, _)| self.get_room(id)) + .filter(|(_, room)| filter.matches(room.state())) + .map(|(_, room)| room.clone()) .collect() }