-
-
Notifications
You must be signed in to change notification settings - Fork 674
unread: Convert unread.streams to Immutable, and update efficiently #4448
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
61b1c10
docs/style: Document gotcha and workaround on Immutable types.
gnprice 4ca8aec
unread [nfc]: Rename an old "direct" selector as being legacy.
gnprice 1c2225b
unread: Add new getUnreadStreams selector.
gnprice 9d2445d
unread [nfc]: Convert getUnreadStreams use in getUnreadByStream.
gnprice 3eec017
unread [nfc]: Convert getUnreadStreams use in getUnreadStreamsAndTopics.
gnprice fc1532e
unread: Convert getUnreadStreams use in getUnreadCountForNarrow.
gnprice 2f7c076
unread: Convert unreadStreams use in getTopicsForStream.
gnprice 7d164fd
unread [nfc]: Cut getUnreadStreamsLegacy.
gnprice e3a2f94
unread tests: Delete a spurious test.
gnprice 89cff7c
unread: Convert unread.streams to Immutable!
gnprice 4849292
unread tests: Add a test for not touching unaffected parts of state.
gnprice 8dc3fe6
unread: Use state.messages to optimize updating stream unreads.
gnprice 5725e7d
unread: Speed up initial-data loading by constructing in batch.
gnprice 09cbcec
unread [nfc]: Factor out deleteFromListMap.
gnprice File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
e0874fd unread: Use state.messages to optimize updating stream unreads.
This is fine even though the branch just improves handling for stream messages (not PMs or mentions), right? 🙂
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah. Hmm, it looks like I may not have written out this part of my reasoning: I expect that it's very rare for the other parts of this data structure to get to be real giant, like the streams part easily does.
You can get 50k unread stream messages just by being in a busy org like chat.zulip.org, being subscribed to some busy streams (perhaps by default), and just not staying caught up all the time.
To get to even 1k unread PMs or unread mentions, or even 100 of them, seems a lot harder. You could get 100, perhaps, by being in a group-PM thread where some other people are talking to each other a lot; or from
@everyonementions in a busy org where those are common practice.So I think making the other parts of this data structure efficient will have much less of a direct performance benefit. It'd still be good to do it, but the main benefits will be to deduplicate this logic (there's a lot that's shared between the four different reducers here) and perhaps to simplify some of the code that consumes this data.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense!