atagen

malice

public
Star0
Watch0

Commit 29f052e95a65

tarball

atagen <boss@atagen.co>2026-10-26 03:48 UTC

1 file changed+4-4
core: share room summaries instead of deep cloning them per change

Every rooms change cloned each RoomSummary before serialising. imbl::Vector shares structure, so the clone is now O(1) and the wire format is unchanged.
Modified file: crates/malice-core/src/feed.rs+4 additions−4 deletions
@@ -25,7 +25,7 @@ pub enum WireEvent {
2525 packs: ImagePacks,
2626 },
2727 Rooms {
28- rooms: Vec<RoomSummary>,
28+ rooms: Vector<RoomSummary>,
2929 },
3030 Timeline {
3131 room_id: String,
@@ -89,7 +89,7 @@ pub enum WireEvent {
8989
9090 #[derive(Debug, Clone, Serialize)]
9191 pub struct Snapshot {
92- pub rooms: Vec<RoomSummary>,
92+ pub rooms: Vector<RoomSummary>,
9393 pub timelines: HashMap<String, Vector<TimelineItem>>,
9494 pub pinned: HashMap<String, Vector<TimelineItem>>,
9595 pub threads: Vec<ThreadItems>,
@@ -167,7 +167,7 @@ pub fn snapshot_event(state: &State) -> WireEvent {
167167 })
168168 .collect();
169169 WireEvent::Snapshot(Box::new(Snapshot {
170- rooms: state.rooms.iter().cloned().collect(),
170+ rooms: state.rooms.clone(),
171171 timelines,
172172 pinned,
173173 threads,
@@ -207,7 +207,7 @@ pub fn wire_events(change: &StateChange) -> Vec<WireEvent> {
207207 events
208208 }
209209 StateChange::Rooms(rooms) => vec![WireEvent::Rooms {
210- rooms: rooms.iter().cloned().collect(),
210+ rooms: rooms.clone(),
211211 }],
212212 StateChange::Timeline {
213213 timeline_id: TimelineId::Room(room_id),