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 2023-09-27] [Performance] Improve performance, reduce renders on opening RHP and pages within #22996

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

Comments

@mountiny
Copy link
Contributor

mountiny commented Jul 17, 2023

Problem

When opening the RHP and pages within, there is many more re-renders happening than necessary. #21049 (comment)

This leaves us with sometimes janky animation in the RHP as there is big load for the app #21049 (comment)

Solution

Investigate why there is so many re-renders and find ways to reduce them to as few as possible.

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~019347f7a628ea6599
  • Upwork Job ID: 1680897356746444800
  • Last Price Increase: 2023-07-17
@mountiny mountiny added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Jul 17, 2023
@melvin-bot
Copy link

melvin-bot bot commented Jul 17, 2023

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

@mountiny mountiny added the Internal Requires API changes or must be handled by Expensify staff label Jul 17, 2023
@melvin-bot
Copy link

melvin-bot bot commented Jul 17, 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

@melvin-bot
Copy link

melvin-bot bot commented Jul 17, 2023

Job added to Upwork: https://www.upwork.com/jobs/~019347f7a628ea6599

@melvin-bot
Copy link

melvin-bot bot commented Jul 17, 2023

Triggered auto assignment to Contributor Plus for review of internal employee PR - @mananjadhav (Internal)

@mountiny
Copy link
Contributor Author

Making this internal and exporting to some agency

@WoLewicki
Copy link
Contributor

Me and @adamgrzybowski are looking at it as a part of adding smooth RHP animations 🚀

@hannojg
Copy link
Contributor

hannojg commented Jul 17, 2023

I would like to check the re-render count when applying the changes proposed here:

won't interfere with you, its your task, just curious if it gets any better with the mentioned changed.

@WoLewicki
Copy link
Contributor

Yeah, we can do that for sure 🚀

@mountiny
Copy link
Contributor Author

Thank Hanno! Assigned you Wojti, this will be in good hands 🙇

@WoLewicki
Copy link
Contributor

From a fast check, when opening the personal details, this line executes:

API.read('OpenPublicProfilePage', {accountID}, {optimisticData, successData, failureData});
and it updates the ONYXKEYS.PERSONAL_DETAILS_LIST, which causes a huge amount of rerenders, slowing down the app. @hannojg could you check if applying both your PR to onyx and this one: #21406 makes it perform much better? Hopefully your PR introduces better caching for this part also 🚀

@mountiny mountiny changed the title Improve performance, reduce renders on opening RHP and pages within [Performance] Improve performance, reduce renders on opening RHP and pages within Jul 18, 2023
@mountiny
Copy link
Contributor Author

@WoLewicki Thank, I think there is lots of things happening at once now to improve the performance, but it would still be great to profile this flow to see whats the bottleneck. Let us know how that goes

@hannojg
Copy link
Contributor

hannojg commented Jul 19, 2023

@WoLewicki I commented it in the wrong place, so here is it posted again:

Okay, the PR doesn't directly help with the BaseModal, but here is an interesting number.

Web, render whole app with a user's profile open: 243 commits, 2.5 seconds till last commit
Web, but with PR + changes in place: 176 commits, 1.5 seconds till last commit

@WoLewicki
Copy link
Contributor

That's nice. Did you check if reopening the profile again makes that numbers smaller? I believe there shouldn't be any/much more info coming with each update of ONYXKEYS.PERSONAL_DETAILS_LIST, but we'd have to research what is changed there that causes rerenders.

@hannojg
Copy link
Contributor

hannojg commented Jul 20, 2023

Will check that by tomorrow!

@melvin-bot melvin-bot bot added the Overdue label Jul 21, 2023
@mountiny
Copy link
Contributor Author

Not overdue

@melvin-bot melvin-bot bot added Overdue and removed Overdue labels Jul 21, 2023
@mountiny
Copy link
Contributor Author

@WoLewicki Let us know if you will have any updates.

@melvin-bot melvin-bot bot added Overdue and removed Overdue labels Jul 24, 2023
@melvin-bot melvin-bot bot removed the Overdue label Aug 28, 2023
@melvin-bot melvin-bot bot added Reviewing Has a PR in review Weekly KSv2 and removed Daily KSv2 labels Aug 29, 2023
@WoLewicki
Copy link
Contributor

I created a PR with two probable improvements. I am not sure about the second one (https://github.com/Expensify/App/pull/26217/files#diff-fbf18141daa663ca1e0398aa28431fc6268fec4405b4d231bbdb76a29d595aaaR66), but since only those 2 fields seem to be used in the binded methods, there should be no need to provide new context values if they did not change. It fixes the whole app rerendering each time we open the personal details.

@mountiny could I get more information about the isLoading prop in withCurrentUserPersonalDetails which brings many many rerenders as I mentioned in #22996 (comment)? I couldn't get to the code that uses it.

@WoLewicki
Copy link
Contributor

I added memoization of WithCurrentUserPersonalDetails: https://github.com/Expensify/App/pull/26217/files#diff-7a254ee6fc92c6fd404d8e3d60431e33697e69d186745f4c8d9b2848b73a1a48R50, but I am not sure if it is the right thing to do (but seems so). Fortunately isLoading prop only changes for the person you are in a report with, and the withCurrentUserPersonalDetails is used for your account, so it does not affect the memo right now.

@mananjadhav
Copy link
Collaborator

@mountiny Does this require C+ review?

@mountiny
Copy link
Contributor Author

@mananjadhav yeah, you can also revie the pr then

What do you think of @WoLewicki proposal?

@mananjadhav
Copy link
Collaborator

I think we can use @WoLewicki's proposal to reduce the number of renders. This would work. Looking at the PR now.

@mountiny mountiny moved this from Todo to LOW in [#whatsnext] #quality Sep 7, 2023
@mountiny mountiny moved this from LOW to HIGH in [#whatsnext] #quality Sep 7, 2023
@melvin-bot melvin-bot bot added Weekly KSv2 Awaiting Payment Auto-added when associated PR is deployed to production and removed Weekly KSv2 labels Sep 20, 2023
@melvin-bot melvin-bot bot changed the title [Performance] Improve performance, reduce renders on opening RHP and pages within [HOLD for payment 2023-09-27] [Performance] Improve performance, reduce renders on opening RHP and pages within Sep 20, 2023
@melvin-bot melvin-bot bot removed the Reviewing Has a PR in review label Sep 20, 2023
@melvin-bot
Copy link

melvin-bot bot commented Sep 20, 2023

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

@melvin-bot
Copy link

melvin-bot bot commented Sep 20, 2023

The solution for this issue has been 🚀 deployed to production 🚀 in version 1.3.71-12 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 2023-09-27. 🎊

After the hold period is over and BZ checklist items are completed, please complete any of the applicable payments for this issue, and check them off once done.

  • External issue reporter
  • Contributor that fixed the issue
  • Contributor+ that helped on the issue and/or PR

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

  • @mananjadhav does not require payment (Eligible for Manual Requests)
  • @WoLewicki does not require payment (Contractor)

As a reminder, here are the bonuses/penalties that should be applied for any External issue:

  • Merged PR within 3 business days of assignment - 50% bonus
  • Merged PR more than 9 business days after assignment - 50% penalty

@melvin-bot
Copy link

melvin-bot bot commented Sep 20, 2023

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:

  • [@mananjadhav] The PR that introduced the bug has been identified. Link to the PR:
  • [@mananjadhav] 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:
  • [@mananjadhav] 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:
  • [@mananjadhav] Determine if we should create a regression test for this bug.
  • [@mananjadhav] 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.
  • [@NicMendonca] Link the GH issue for creating/updating the regression test once above steps have been agreed upon:

@mountiny
Copy link
Contributor Author

@NicMendonca I believe we just need to pay $1000 to Manan as this was before the payment change

No checklist needed as this was performance improvement

@melvin-bot melvin-bot bot added Daily KSv2 and removed Weekly KSv2 labels Sep 26, 2023
@NicMendonca
Copy link
Contributor

@mananjadhav remind me, do you request payment via Expensify, or Upwork? Thanks!

@mananjadhav
Copy link
Collaborator

@NicMendonca I'll raise it via Expensify.

@NicMendonca
Copy link
Contributor

Thank you!

@JmillsExpensify
Copy link

$1,000 approved for payment to @mananjadhav based on BZ summary.

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. Daily KSv2 Engineering Internal Requires API changes or must be handled by Expensify staff
Projects
Status: Done
Development

No branches or pull requests

6 participants