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

Room list sorting algorithm can be improved #8122

Closed
turt2live opened this issue Jan 14, 2019 · 1 comment
Closed

Room list sorting algorithm can be improved #8122

turt2live opened this issue Jan 14, 2019 · 1 comment
Assignees
Labels
A-Performance T-Task Tasks for the team like planning

Comments

@turt2live
Copy link
Member

Currently the room list is regenerated from scratch every time the user receives a message or other event which triggers an update. This can lead to some serious performance issues on large accounts when the algorithm is touched in the slightest way due to amplification.

There's a couple options here:

  1. Change the algorithm to be smart about sorting the list and shuffle rooms around as needed rather than regenerate it. This is difficult to get right because the conditions to trigger a reorder aren't perfect and can easily lead to stuck rooms.
  2. Figure out how to make React prefer to keep elements around instead of destroying them. Currently, the bulk of the reorder operation is actually React trying to render all 2k+ tiles. The actual ordering can take less than 50ms for the whole list, and hundreds of milliseconds to render.

Both of these issues aren't really a problem yet, but as mentioned can quickly become an issue if the algorithm is changed slightly. For instance, calling the SettingsStore within the sort function can cause delays of 5+ seconds per cycle.

For now, it's probably best we just be extremely careful in modifying the algorithm instead of rewriting it to be less prone to causing performance issues.

@turt2live
Copy link
Member Author

Fixed by matrix-org/matrix-react-sdk#2634

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Performance T-Task Tasks for the team like planning
Projects
None yet
Development

No branches or pull requests

2 participants