-
Notifications
You must be signed in to change notification settings - Fork 243
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
Speed up sliding sync by avoiding copies #17670
Conversation
We ended up spending ~10% CPU creating a new dictionary and `_RoomMembershipForUser`, so let's avoid creating new dicts and copying by returning `newly_joined`, `newly_left` and `is_dm` as sets directly.
@@ -519,7 +524,7 @@ async def get_room_sync_data( | |||
from_bound = None | |||
initial = True | |||
ignore_timeline_bound = False | |||
if from_token and not room_membership_for_user_at_to_token.newly_joined: |
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.
We can remove this logic because we're just going to rely on HaveSentRoomFlag.NEVER
?
We should update the comment above
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, oops sorry. Having thought about this some more we probably want to keep this flag (in the case where people join / leave / join).
Co-authored-by: Eric Eastwood <[email protected]>
Co-authored-by: Eric Eastwood <[email protected]>
Co-authored-by: Eric Eastwood <[email protected]>
333268a
to
91f2591
Compare
We ended up spending ~10% CPU creating a new dictionary and
_RoomMembershipForUser
, so let's avoid creating new dicts and copying by returningnewly_joined
,newly_left
andis_dm
as sets directly.