apply_event: Replace list comprehension with list.remove.

This should be about 4 times faster, saving something like half a
millisecond on each stream of 10000 subscribers.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
This commit is contained in:
Anders Kaseorg 2019-12-31 08:12:21 -08:00 committed by Tim Abbott
parent bbafced254
commit 8f281c4fc9
1 changed files with 1 additions and 1 deletions

View File

@ -647,7 +647,7 @@ def apply_event(state: Dict[str, Any],
# Remove our user from the subscribers of the removed subscriptions.
if include_subscribers:
for sub in removed_subs:
sub['subscribers'] = [id for id in sub['subscribers'] if id != user_profile.id]
sub['subscribers'].remove(user_profile.id)
# We must effectively copy the removed subscriptions from subscriptions to
# unsubscribe, since we only have the name in our data structure.