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

[$250] [HOLD for payment 2024-06-28] [HOLD for payment 2024-06-24] [LOW] [Performance] Improve the performance of getOrderedReportIDs #43488

Closed
mountiny opened this issue Jun 11, 2024 · 24 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 External Added to denote the issue can be worked on by a contributor

Comments

@mountiny
Copy link
Contributor

mountiny commented Jun 11, 2024

Coming from here

Problem

Constantly copying all reports in the getOrderedReportIDs function is resource-intensive. We're doing this just to add a single property, and we are using only 2 copied properties. This process significantly increases the function's runtime.

report = {
    ...report,
    displayName: ReportUtils.getReportName(report),
};

Solution

Avoid copying the entire report object. Instead, create a minimized report version that only includes the necessary properties. This approach is safe as these data are used solely for sorting.

type MiniReport = {
    reportID?: string;
    displayName: string;
    lastVisibleActionCreated?: string;
};
// ...

const miniReport: MiniReport = {
    reportID: report?.reportID,
    displayName: ReportUtils.getReportName(report),
    lastVisibleActionCreated: report?.lastVisibleActionCreated,
};

On my heavy account, I've tested it, and here are the results:

  • getOrderedReportIDs function call time: 36% improvement in performance, reduced from 185ms (SD 3ms) → 118ms (SD 8ms), n = 10, measured in the code,
  • ReportIDsContextProvider render time: 28% improvement in performance, reduced from 233ms (SD 4ms) → 168ms (SD 2ms), n = 3, measured using a profiler,

A POC with performance measurements is available here. Please let me know if you have any questions.

Issue OwnerCurrent Issue Owner: @
Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~01facc6fcf70a639b9
  • Upwork Job ID: 1805325257306582163
  • Last Price Increase: 2024-06-24
Issue OwnerCurrent Issue Owner: @joekaufmanexpensify
@mountiny mountiny added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Jun 11, 2024
@mountiny mountiny self-assigned this Jun 11, 2024
Copy link

melvin-bot bot commented Jun 11, 2024

Triggered auto assignment to @joekaufmanexpensify (Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details. Please add this bug to a GH project, as outlined in the SO.

@mountiny
Copy link
Contributor Author

@kosmydel will take this one

@joekaufmanexpensify
Copy link
Contributor

@kosmydel please comment and I'll assign you

@kosmydel
Copy link
Contributor

Commenting :)

@mountiny
Copy link
Contributor Author

PR in review

@joekaufmanexpensify
Copy link
Contributor

About to go OOO until 2024-06-25, but don't think payment will be due before then, so not adding an additional assignee. Please re-add bug label if someone comes up in the interim while I am away.

@melvin-bot melvin-bot bot added Weekly KSv2 Awaiting Payment Auto-added when associated PR is deployed to production and removed Weekly KSv2 labels Jun 17, 2024
@melvin-bot melvin-bot bot changed the title [LOW] [Performance] Improve the performance of getOrderedReportIDs [HOLD for payment 2024-06-24] [LOW] [Performance] Improve the performance of getOrderedReportIDs Jun 17, 2024
@melvin-bot melvin-bot bot removed the Reviewing Has a PR in review label Jun 17, 2024
Copy link

melvin-bot bot commented Jun 17, 2024

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

Copy link

melvin-bot bot commented Jun 17, 2024

The solution for this issue has been 🚀 deployed to production 🚀 in version 1.4.84-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-06-24. 🎊

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

  • @kosmydel does not require payment (Contractor)

Copy link

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

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

@melvin-bot melvin-bot bot added Weekly KSv2 and removed Weekly KSv2 labels Jun 21, 2024
@melvin-bot melvin-bot bot changed the title [HOLD for payment 2024-06-24] [LOW] [Performance] Improve the performance of getOrderedReportIDs [HOLD for payment 2024-06-28] [HOLD for payment 2024-06-24] [LOW] [Performance] Improve the performance of getOrderedReportIDs Jun 21, 2024
Copy link

melvin-bot bot commented Jun 21, 2024

The solution for this issue has been 🚀 deployed to production 🚀 in version 1.4.85-7 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-06-28. 🎊

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

  • @kosmydel does not require payment (Contractor)

Copy link

melvin-bot bot commented Jun 21, 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:

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

@joekaufmanexpensify
Copy link
Contributor

@shubham1206agra mind commenting here so I can assign you? I see you were C+ for this one

@shubham1206agra
Copy link
Contributor

👋🏽

@melvin-bot melvin-bot bot added Daily KSv2 and removed Weekly KSv2 labels Jun 24, 2024
@joekaufmanexpensify joekaufmanexpensify added the External Added to denote the issue can be worked on by a contributor label Jun 24, 2024
Copy link

melvin-bot bot commented Jun 24, 2024

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

@melvin-bot melvin-bot bot changed the title [HOLD for payment 2024-06-28] [HOLD for payment 2024-06-24] [LOW] [Performance] Improve the performance of getOrderedReportIDs [$250] [HOLD for payment 2024-06-28] [HOLD for payment 2024-06-24] [LOW] [Performance] Improve the performance of getOrderedReportIDs Jun 24, 2024
@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Jun 24, 2024
Copy link

melvin-bot bot commented Jun 24, 2024

Current assignee @shubham1206agra is eligible for the External assigner, not assigning anyone new.

@joekaufmanexpensify joekaufmanexpensify removed the Help Wanted Apply this label when an issue is open to proposals by contributors label Jun 24, 2024
@joekaufmanexpensify
Copy link
Contributor

@shubham1206agra is checklist needed here?

@joekaufmanexpensify
Copy link
Contributor

Only payment here is $250 to @shubham1206agra via upwork for C+

@joekaufmanexpensify
Copy link
Contributor

@shubham1206agra offer sent for $250!

@shubham1206agra
Copy link
Contributor

@shubham1206agra is checklist needed here?

No

@shubham1206agra
Copy link
Contributor

@shubham1206agra offer sent for $250!

@joekaufmanexpensify Accepted

@joekaufmanexpensify
Copy link
Contributor

Great! All set to pay then.

@joekaufmanexpensify
Copy link
Contributor

@shubham1206agra $250 sent and contract ended!

@joekaufmanexpensify
Copy link
Contributor

Upwork job closed.

@joekaufmanexpensify
Copy link
Contributor

All set, thanks everyone!

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 External Added to denote the issue can be worked on by a contributor
Projects
Status: Done
Development

No branches or pull requests

4 participants