-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
iOS - App is extremely slow to load conversations #3167
Comments
Triggered auto assignment to @Jag96 ( |
Looking into what caused this as this seems like a regression, some additional notes:
|
This was reproducible on iPad too. Here are the device logs |
I don't see anything unusual in those logs. But also can't reproduce this in simulator. I'm noticing from the video shared above that there are a number of attachments in the chat we are trying to load and the spinner doesn't go away until they are all loaded. So perhaps fetching those images is blocking the JS thread? |
I'm testing against the production API to rule out local dev environment slowness. |
I tried changing the ThumbnailImage and ImageView components to just render empty I see |
After some testing it looks like the issue starts happening on version |
Looks like the culprit is #2320, testing and looking into what is causing the slowness |
I've removed this subscription and it seems to have made loading chats much faster and more consistent on my simulator and my physical device. Going to have somebody else test to confirm. |
I've created a PR that will reduce the slowness here: #3169. @yuwenmemon please have a look, if we want to move forward with this fix it will break the draftComment feature and a new fix will have to be implemented. |
Interesting - but the |
I believe the main issue is that we're creating a subscription for each message, so for chats with lots of messages loading up the chat takes longer. |
Spot on! Furthermore any edits made would capture an empty draft message in storage, which means, even though the message is empty Onyx would try to retrieve it from storage Expensify.cash.-.Google.Chrome.2021-05-27.10-54-21.mp4It's rather expensive to store and retrieve each action's draft message separately, why not store them:
This would be improved significantly by the Onyx optimization I'm working on - you can try it out on this branch: https://github.com/kidroca/Expensify.cash/tree/kidroca/sample-onyx-benchmark it's running v1.0.53 |
@JmillsExpensify Experienced some issues that seems related to this performance issue.
I was unable to reproduce both issues on my device but I think it's because I don't have super long conversations in my testing accounts. Linking the slack thread here. https://expensify.slack.com/archives/C01GTK53T8Q/p1622129132329200 |
Both of these suggestions sound like good ideas to me – I think |
During the review of this PR, we found another performance improvement with regard to #2320 that can be made in addition to the ones suggested above. Two So maybe a good takeaway from this is that we should be careful when adding new Onyx subscriptions, particularly uses of |
I don't want to submit a pull request without benchmarking, but I found another similar instance where we could remove duplicate Onyx subscriptions to try and improve overall app performance:
|
@roryabraham, Although suggestion looks good but I feel that these optimization will be unnecessary after fixes here #2762. |
Very excited for the Onyx improvements, and I agree my suggestion above will likely be negligible in comparison, but I'm wondering if people agree that in general it's a "best practice" to eliminate unnecessary duplicate Onyx subscriptions. |
If are following trend of Redux then it suggests to move the subscription down the tree and avoid passing props from Parent to Child. And it makes sense to me, whole point is to remove the props chain. |
Makes sense to me too! Let me clarify my suggested best practice: "When there are many instances of a component (or components) that use In both of the examples I found, I'm not suggesting moving the subscription up the component tree. Instead, we're eliminating the use of |
Ohk. Yeah that could be good overall. |
Stopping by to say that it took ~2 mins to load a chat on iOS right now. (possibly unrelated... desktop just updated and is better/faster than in a LONG time). |
Left a comment on this PR with some results from testing, as @parasharrajat said earlier I think adding the Onyx cache is going to help a lot with speeding this up, but I agree we should still be mindful about duplicate onyx subscriptions. |
That may be so but there are exceptions.
Keep in mind that each For example nothing is ever clearing Compared to data coming from a parent component - the parent component would release resources as well as the onyx connection when it unmounts It might not be a problem for a simple data like With all that said there a still room for improvement in how Opened a ticket regarding further |
Looking at this thread it seems that the slowness issues on mobile have been alleviated. Going to close this, if we want to optimize subscriptions we can create a new issue, but I feel like between Expensify/react-native-onyx#76 and Expensify/react-native-onyx#78 we're ok for now. |
If you haven’t already, check out our contributing guidelines for onboarding and email [email protected] to request to join our Slack channel!
Expected Result:
Conversations should be loaded quickly.
Actual Result:
Conversation are taking ~5 seconds to load even when navigating out and back again to the same conversation.
Action Performed:
Workaround:
Unknown.
Platform:
Where is this issue occurring?
Web
iOS ✔️
Android
Desktop App
Mobile Web
Version Number: 1.0.54-0
Logs: https://stackoverflow.com/c/expensify/questions/4856
Notes/Photos/Videos: Any additional supporting documentation
RPReplay_Final1622049740.MP4
Expensify/Expensify Issue URL:
View all open jobs on Upwork
From @coleaeason https://expensify.slack.com/archives/C01GTK53T8Q/p1622001718242700
The text was updated successfully, but these errors were encountered: