Skip to content
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

Merged
merged 7 commits into from
Sep 6, 2024
Merged

Conversation

erikjohnston
Copy link
Member

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.

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.
@erikjohnston erikjohnston marked this pull request as ready for review September 5, 2024 13:58
@erikjohnston erikjohnston requested a review from a team as a code owner September 5, 2024 13:59
@@ -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:
Copy link
Contributor

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

Copy link
Member Author

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).

synapse/handlers/sliding_sync/room_lists.py Outdated Show resolved Hide resolved
synapse/handlers/sliding_sync/room_lists.py Outdated Show resolved Hide resolved
synapse/handlers/sliding_sync/room_lists.py Outdated Show resolved Hide resolved
synapse/handlers/sliding_sync/room_lists.py Outdated Show resolved Hide resolved
@erikjohnston erikjohnston merged commit d5accec into develop Sep 6, 2024
37 of 39 checks passed
@erikjohnston erikjohnston deleted the erikj/ss_avoid_copies branch September 6, 2024 10:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants