Repository navigation
[HOLD for payment 2024-03-29] [Performance] Chat Switch Improvement Part 1 #32793
Description
Coming from this proposal from @hurali97
### Problem/Solution:
On Android, switching a chat takes noticeable time and doesn’t offer a good user experience. Benchmarking the main on a Mid-range android device gives us the following metrics:
Main: 7616, 7628, 7639, 7643, 7649 = 7635 ms
These durations are recorded on a debug build so we can assume that in production it’ll be shorter but that doesn’t guarantee good user experience, especially on low-end/ mid-range device. After investigating, the areas we find that this is one of the most complex piece to improve, so let’s start with what’s rather doable.
LHNOptionList leverages withCurrentReportID which adds to the rendering time and also re-rendering of the list when currentReportID is changed. The ideal solution is to put useCurrentReportID directly in the OptionRowLHNData since currentReportID is being used to evaluate isFocused prop for this component. We can save that process and do it where it’s needed to not render other parts of React tree.
When user taps on OptionRowLHNData the user navigates to the ReportScreen in that period a few unnecessary Onyx calls are being made:
First up is ComposeWithSuggestion where draft is set to false, even if it’s already set to false. Because in SilentCommentUpdater we call updateComment on mount.
Next, InteractionManager can be used to offload the work that happens before the user navigates to the ReportScreen. We can delay that work until the navigation is completed so that the user doesn’t feel that onPress is stuck.
Whole reportAction is being passed to ReportActionItem and it only uses some properties from it, so it makes sense to make it light weight and then pass it to ReportActionItem . The same concept is applied to ReportActionsList which now uses light weight report object.
Finally, there were handful unnecessary re-renders happening down the tree due to inline objects and functions 🚫
After all these improvements following is the results on debug build on the mid-range android device:
Android: 4221, 4137, 4102, 4096, 4160 = 4143.2 ms
So there’s about 3500 ms reduction in the total time, giving us around 4143.2 ms ( as compared to 7635 ms ), from when user taps on the OptionRowLHN and until the report is visible. There’s still room for improvement in this area and we will try to follow up on this with another PR.
As of now, as part of the investigation we also created the PR here, which will be ready for review after some cleanup and failing tests 🙏
P.S: some of the changes are already present in PR so they will be removed from this PR once the mentioned PR is merged.
Upwork Automation - Do Not Edit
- Upwork Job URL: https://www.upwork.com/jobs/~01b6dca257065e9f96
- Upwork Job ID: 1734155699026690048
- Last Price Increase: 2023-12-11
Issue Owner
Current Issue Owner: @alexpensifyMetadata
Metadata
Labels
Type
Projects
- StatusShow more project fieldsDone
Activity
melvin-bot commentedon Dec 11, 2023
Triggered auto assignment to @alexpensify (
Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details.melvin-bot commentedon Dec 11, 2023
Bug0 Triage Checklist (Main S/O)
Platformsin OP are ✅)hurali97 commentedon Dec 11, 2023
@mountiny Can you assign this to me ?
melvin-bot commentedon Dec 11, 2023
Job added to Upwork: https://www.upwork.com/jobs/~01b6dca257065e9f96
melvin-bot commentedon Dec 11, 2023
Current assignee @allroundexperts is eligible for the Internal assigner, not assigning anyone new.
55 remaining items
alexpensify commentedon Mar 30, 2024
With @mountiny's feedback, here is the payment summary:
Upwork Job: N/A
Extra Notes regarding payment: There is regression which typically results in a decrease in pay. After reviewing this GH, these changes were complex. I'm suggesting leaving the bounty amount at the standard rate.
mallenexpensify commentedon Mar 31, 2024
@alexpensify , added
is due payment via NewDot,to make it clear I have the below saved as a textexpander, to help keep things consistent.alexpensify commentedon Apr 1, 2024
Noted!
JmillsExpensify commentedon Apr 30, 2024
$500 approved for @allroundexperts