Lower the complexity of the group filtering algorithm (#380)

The old algorithm during filtering will check every room
if it's part of the group. O(N*G)

The room ids for a group are now stored in a map for faster lookup
so the search can be completed in a single pass. O(N)
This commit is contained in:
Konstantinos Sideris 2018-07-21 13:35:36 +03:00
parent 9d718fccf4
commit 54c7eb374a
6 changed files with 52 additions and 44 deletions

View file

@ -514,9 +514,9 @@ ChatPage::ChatPage(QSharedPointer<UserSettings> userSettings, QWidget *parent)
current_community_ = groupId;
if (groupId == "world")
room_list_->setFilterRooms(false);
room_list_->removeFilter();
else
room_list_->setRoomFilter(communitiesList_->roomList(groupId));
room_list_->applyFilter(communitiesList_->roomList(groupId));
});
connect(&notificationsManager,