Skip to content
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

[HOLD for payment 2024-03-29] [Performance] Chat Switch Improvement Part 1 #32793

Closed
mountiny opened this issue Dec 11, 2023 · 32 comments
Closed
Assignees
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. Internal Requires API changes or must be handled by Expensify staff Weekly KSv2

Comments

@mountiny
Copy link
Contributor

mountiny commented Dec 11, 2023

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 OwnerCurrent Issue Owner: @alexpensify
@mountiny mountiny added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Dec 11, 2023
@mountiny mountiny self-assigned this Dec 11, 2023
Copy link

melvin-bot bot commented Dec 11, 2023

Triggered auto assignment to @alexpensify (Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details.

Copy link

melvin-bot bot commented Dec 11, 2023

Bug0 Triage Checklist (Main S/O)

  • This "bug" occurs on a supported platform (ensure Platforms in OP are ✅)
  • This bug is not a duplicate report (check E/App issues and #expensify-bugs)
    • If it is, comment with a link to the original report, close the issue and add any novel details to the original issue instead
  • This bug is reproducible using the reproduction steps in the OP. S/O
    • If the reproduction steps are clear and you're unable to reproduce the bug, check with the reporter and QA first, then close the issue.
    • If the reproduction steps aren't clear and you determine the correct steps, please update the OP.
  • This issue is filled out as thoroughly and clearly as possible
    • Pay special attention to the title, results, platforms where the bug occurs, and if the bug happens on staging/production.
  • I have reviewed and subscribed to the linked Slack conversation to ensure Slack/Github stay in sync

@hurali97
Copy link
Contributor

@mountiny Can you assign this to me ?

@mountiny mountiny added the Internal Requires API changes or must be handled by Expensify staff label Dec 11, 2023
Copy link

melvin-bot bot commented Dec 11, 2023

Job added to Upwork: https://www.upwork.com/jobs/~01b6dca257065e9f96

Copy link

melvin-bot bot commented Dec 11, 2023

Current assignee @allroundexperts is eligible for the Internal assigner, not assigning anyone new.

@mountiny mountiny added the Reviewing Has a PR in review label Dec 11, 2023
@melvin-bot melvin-bot bot added Weekly KSv2 and removed Daily KSv2 labels Dec 11, 2023
@melvin-bot melvin-bot bot added Weekly KSv2 and removed Weekly KSv2 labels Dec 20, 2023
@melvin-bot melvin-bot bot added Monthly KSv2 and removed Weekly KSv2 labels Jan 12, 2024
Copy link

melvin-bot bot commented Jan 12, 2024

This issue has not been updated in over 15 days. @alexpensify, @allroundexperts, @mountiny, @hurali97 eroding to Monthly issue.

P.S. Is everyone reading this sure this is really a near-term priority? Be brave: if you disagree, go ahead and close it out. If someone disagrees, they'll reopen it, and if they don't: one less thing to do!

@mountiny
Copy link
Contributor Author

Still working on this

@muttmuure muttmuure moved this from CRITICAL to HIGH in [#whatsnext] #quality Feb 2, 2024
Copy link

melvin-bot bot commented Mar 11, 2024

⚠️ Looks like this issue was linked to a Deploy Blocker here

If you are the assigned CME please investigate whether the linked PR caused a regression and leave a comment with the results.

If a regression has occurred and you are the assigned CM follow the instructions here.

If this regression could have been avoided please consider also proposing a recommendation to the PR checklist so that we can avoid it in the future.

@melvin-bot melvin-bot bot added Weekly KSv2 and removed Monthly KSv2 labels Mar 11, 2024
@melvin-bot melvin-bot bot added Reviewing Has a PR in review Weekly KSv2 Daily KSv2 and removed Weekly KSv2 labels Mar 13, 2024
Copy link

melvin-bot bot commented Mar 20, 2024

Payment Summary

Upwork Job

BugZero Checklist (@alexpensify)

  • I have verified the correct assignees and roles are listed above and updated the neccesary manual offers
  • I have verified that there are no duplicate or incorrect contracts on Upwork for this job (https://www.upwork.com/ab/applicants/1734155699026690048/hired)
  • I have paid out the Upwork contracts or cancelled the ones that are incorrect
  • I have verified the payment summary above is correct

Copy link

melvin-bot bot commented Mar 20, 2024

⚠️ Looks like this issue was linked to a Deploy Blocker here

If you are the assigned CME please investigate whether the linked PR caused a regression and leave a comment with the results.

If a regression has occurred and you are the assigned CM follow the instructions here.

If this regression could have been avoided please consider also proposing a recommendation to the PR checklist so that we can avoid it in the future.

@alexpensify
Copy link
Contributor

@allroundexperts is this warning an error or valid?

@allroundexperts
Copy link
Contributor

This is valid. We have discovered a small UI issue.

@alexpensify
Copy link
Contributor

I see one of the PR is merged into production. I think the automation is off here, it looks like there is another related PR in the review process. I think we should hold off on payments until then but keep me posted @allroundexperts.

@melvin-bot melvin-bot bot added Weekly KSv2 and removed Daily KSv2 labels Mar 22, 2024
@melvin-bot melvin-bot bot changed the title [HOLD for payment 2024-03-20] [Performance] Chat Switch Improvement Part 1 [HOLD for payment 2024-03-29] [HOLD for payment 2024-03-20] [Performance] Chat Switch Improvement Part 1 Mar 22, 2024
@melvin-bot melvin-bot bot removed the Reviewing Has a PR in review label Mar 22, 2024
Copy link

melvin-bot bot commented Mar 22, 2024

Reviewing label has been removed, please complete the "BugZero Checklist".

Copy link

melvin-bot bot commented Mar 22, 2024

The solution for this issue has been 🚀 deployed to production 🚀 in version 1.4.55-3 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue:

If no regressions arise, payment will be issued on 2024-03-29. 🎊

For reference, here are some details about the assignees on this issue:

Copy link

melvin-bot bot commented Mar 22, 2024

BugZero Checklist: The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed:

  • [@allroundexperts] The PR that introduced the bug has been identified. Link to the PR:
  • [@allroundexperts] The offending PR has been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake. Link to comment:
  • [@allroundexperts] A discussion in #expensify-bugs has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner. Link to discussion:
  • [@allroundexperts] Determine if we should create a regression test for this bug.
  • [@allroundexperts] If we decide to create a regression test for the bug, please propose the regression test steps to ensure the same bug will not reach production again.
  • [@alexpensify] Link the GH issue for creating/updating the regression test once above steps have been agreed upon:

@alexpensify
Copy link
Contributor

@allroundexperts - we are all set here and there are no other PRs to wait for - right?

@alexpensify alexpensify changed the title [HOLD for payment 2024-03-29] [HOLD for payment 2024-03-20] [Performance] Chat Switch Improvement Part 1 [HOLD for payment 2024-03-29] [Performance] Chat Switch Improvement Part 1 Mar 22, 2024
@mallenexpensify
Copy link
Contributor

Looks like this work, and the below PR might be responsible for this

Is this a bug that is already being considered and worked on? Or planned to be addressed in the future?

@alexpensify
Copy link
Contributor

@allroundexperts - can we get an update for @mallenexpensify? I need to confirm if we should handle in another GH and continue with the payment process here. Thanks!

@mallenexpensify
Copy link
Contributor

@allroundexperts 👀 on the above plz

@mountiny
Copy link
Contributor Author

I think we can go ahead with payment on this one, the PR has been complicated and we already had second iteration on it. I have bumped the PR authors to look into that issue and review the proposals.

@alexpensify
Copy link
Contributor

alexpensify commented Mar 30, 2024

With @mountiny's feedback, here is the payment summary:

  • External issue reporter - N/A
  • Contributor that fixed the issue - @hurali97 payment handled by partner
  • Contributor+ that helped on the issue and/or PR - @allroundexperts $500 is due payment via NewDot, please submit the request

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
Copy link
Contributor

mallenexpensify commented 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.

Contributor: @ paid $ via Upwork
Contributor+: @ owed $ via NewDot

@alexpensify
Copy link
Contributor

Noted!

@JmillsExpensify
Copy link

$500 approved for @allroundexperts

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. Internal Requires API changes or must be handled by Expensify staff Weekly KSv2
Projects
Development

No branches or pull requests

6 participants