stakwork / stakwork/sphinx-android-v2
Detect delay causes and improve chat loading time
Nobody has claimed this yet.
- Dominant language
- Kotlin
- Stars
- 7
- Forks
- 14
- Avg merge
- 6h 23m
- Merged PRs (30d)
- 22
Description
When entering a chat from chats list, the chat messages take a few seconds to load and show even when it's a new chat with just a few messages. We are showing a shimmering view while loading them and scrolling to bottom, then hiding it when it's ready
Base branch: develop: project needs to be compiled and run from develop branch where the latest changes are pushed.
Context
- On
screenInit()ofChatViewModelwe are calling the rightgetAllMessagesmethod ofmessageRepositoryto get the chat messages/thread messages. We are fetching a small amount first (100), then loading more. - On
getAllMessagesToShowByChatIdof theSphinxRepositorywe are querying the db, wrapping themessageDboobject intoMessageobjects and linking reactions, replies, purchase msgs, etc to each of them. - On
getMessageHolderViewStateListof theChatViewModelwe are processing the list ofMessagescoming from repository and returning a list ofMessageHolderViewStatethat will be finally set onmessageHolderViewStateFlowwhich is collected onMessageListAdapter MessageHolderViewStateclass contains lazy vars for each Message row section likestatusHeader,imageAttachment, etc
Requirements
- Debug, understand and detect which part of this process takes more time to process causing the delay on chat view load.
- Implement change on logic or UI to improve significantly the loading time of the chat
- If solutions are complex and require any architecture changes that must be handled in a separated ticket, provide details on how this would improve the loading time and general directions on how to implement them
Acceptance Criteria
- Detect the causes or performance issues producing the chat view loading delay
- Implement improvements to reduce it significantly or provide detailed feedback on how to accomplish that
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Compile and run the project from the develop branch, then trace timing through ChatViewModel.screenInit(), messageRepository.getAllMessages, SphinxRepository.getAllMessagesToShowByChatId, and getMessageHolderViewStateList. Profile the database query, Message wrapping and linking, view-state processing, and MessageHolderViewState lazy sections to identify the dominant delay. Done means the cause is documented and chat loading is measurably improved, or complex architectural work is described for a separate ticket.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- kotlin
- Domain
- mobile, performance
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100