-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Description
If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!
What performance issue do we need to solve?
This causes unnecessary renders, slow transitions between reports, slow first render of a report.
We're inefficiently guessing that we need to render 20 messages to fill our chat in the first render. In reality the ideal number of messages is based on the screen height of the user, a small chrome window or a mobile device in landscape mode might need as little as 2 messages to fill the chat.
What is the impact of this on end-users?
Chats will load faster - both when changing between chats and when first opening the app.
List any benchmarks that show the severity of the issue
Added to the benchmarks below.
Proposed solution (if any)
In our ReportActionsView, use the screenHeight to calculate the initialNumToRender of our InvertedFlatList.
We can get the ideal initialNumToRender by calculating how much screen space is available for our reports and how much screen space the smallest report possible takes.
In our ReportScreen, we render:
ReportActionComposewith a minHeight of 90HeaderViewwith a height of 65ReportActionsView, with the smallest report possible having 56 of height (40 for the avatar, 16 of padding)
The ideal initialNumToRender can be estimated by (screenHeight - (90 + 65)) / 56. We round the result up to account for cases where there's enough size for a part of another report to show.
List any benchmarks after implementing the changes to show impacts of the proposed solution (if any)
Benchmarks were run in dev mode, using a simulator for iOS.
- Start on Concierge chat
- Switch to another chat with 100+ messages, with 1 IOU and 2 Images in the last 20 messages
- Check the
CONST.TIMING.SWITCH_REPORT - Repeat 5 times and calculate the average
| Platform | initialNumToRender | Average time to switch reports |
|---|---|---|
| Web - Chrome | Fixed (20) | 3,795.2 ms |
| Web - Chrome | Ideal (7) | 1,336.2 ms |
| iOS - iPhone SE | Fixed (20) | 7016 ms |
| iOS - iPhone SE | Ideal (10) | 3,888.6 ms |
Platform:
Where is this issue occurring?
- Web
- iOS
- Android
- Desktop App
- Mobile Web
Version Number:
Logs: https://stackoverflow.com/c/expensify/questions/4856
Notes/Photos/Videos: Any additional supporting documentation
Upwork URL:* https://www.upwork.com/jobs/~01a5045701b75bc097