mirror of
https://github.com/zulip/zulip.git
synced 2025-11-04 14:03:30 +00:00
streams: Add LazySet for subscribers.
This defers O(N*S) operations, where
N = number of streams
S = number of subscribers per stream
In many cases we never do an O(N) operation on
a stream. Exceptions include:
- checking stream links from the compose box
- editing a stream
- adding members to a newly added stream
An operation that used to be O(N)--computing
the number of subscribers--is now O(1), and we
don't even pay O(N) on a one-time basis to
compute it (not counting the cost to build the
array from JSON, but we have to do that).
This commit is contained in:
@@ -36,12 +36,9 @@ exports.is_sub_settings_active = function (sub) {
|
||||
};
|
||||
|
||||
exports.get_email_of_subscribers = function (subscribers) {
|
||||
const emails = [];
|
||||
subscribers.each(function (o, i) {
|
||||
const email = people.get_person_from_user_id(i).email;
|
||||
emails.push(email);
|
||||
return subscribers.map(function (user_id) {
|
||||
return people.get_person_from_user_id(user_id).email;
|
||||
});
|
||||
return emails;
|
||||
};
|
||||
|
||||
function clear_edit_panel() {
|
||||
|
||||
Reference in New Issue
Block a user