stakwork / stakwork/sphinx-android-v2

Detect delay causes and improve chat loading time

Open
#124 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bounty
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() of ChatViewModel we are calling the right getAllMessages method of messageRepository to get the chat messages/thread messages. We are fetching a small amount first (100), then loading more.
  • On getAllMessagesToShowByChatId of the SphinxRepository we are querying the db, wrapping the messageDbo object into Message objects and linking reactions, replies, purchase msgs, etc to each of them.
  • On getMessageHolderViewStateList of the ChatViewModel we are processing the list of Messages coming from repository and returning a list of MessageHolderViewState that will be finally set on messageHolderViewStateFlow which is collected on MessageListAdapter
  • MessageHolderViewState class contains lazy vars for each Message row section like statusHeader, 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

  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

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.