matrix-org / matrix-org/matrix-ios-sdk

MXRoomSummary step #2

Open
#310 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Objective-C
Stars
484
Forks
225
PR merge metrics
No merged PRs in 30d

Description

Now that app can cache data relative to a room into MXRoomSummary objects, we should not need to load anymore all rooms states, all rooms messages and all rooms account data at startup. We should just need to load all MXRoomSummary which will make app startup quicker. The app will also consume less RAM.

Here are some figures with my account:
```
[MXFileStore] Start data loading from files
[MXFileStore] Loaded room messages of 210 rooms in 869ms
[MXFileStore] Loaded room states of 210 rooms in 2562ms
[MXFileStore] Loaded rooms summaries data of 210 rooms in 804ms
[MXFileStore] Loaded rooms account data of 210 rooms in 610ms
[MXFileStore] Loaded read receipts of 210 rooms in 923ms
[MXFileStore] Loaded 12352 MXUsers in 600ms
[MXFileStore] Data loaded from files in 6370ms
```

Loading room state is the longest but without a clear cache (or a limited timeline in a /sync response), there are more and more messages in the store and loading room messages takes longer and longer.

The change implies asynchronous access to :
- [ ] MXRoom object. It still exposes data got from the store and MXRoomAccountData.
- [ ] MXEventTimeline, providing room messages. It is already asynchronous but it is based on a MXStore that has all data preloaded.
- [ ] MXRoomState, the room state.

I suggest to keep things in memory when they have been asynchronously opened. It cannot be worse than keeping everything in memory as we do atm.

These objects must be opened, or populated on demand. There are 2 cases:
- the user who wants to open a room in the app.
The room will be a bit slower to open but the timing should be reasonable.
- a /sync response contains data about a room.
The additional time to open that room will be transparent to the end user because it will be part of the time to process the /sync response.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No source files or tests are named. Start by tracing MXFileStore startup loading and the MXRoomSummary, MXRoom, MXEventTimeline, MXRoomState, and MXStore entry points, then inspect /sync processing. Done means startup loads summaries rather than all room data, while on-demand room access and /sync remain usable with asynchronous loading.

Written by the indexing model from the issue text.

Assessment

Tech stack
objective-c
Domain
databases, performance
Issue type
Refactor
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.