-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
Add cache to getReportName #47156
Add cache to getReportName #47156
Conversation
@neil-marcellini Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me. Thanks. I see we're only caching for a few cases which seems fine.
We should do at least one manual test for this, so please write test / QA steps and record a video on one platform. Please also link the PR to an issue. I don't think we need a C+ for this simple change though. |
Pasting this to get the check passing. I'm confident that the change should be fine. Reviewer Checklist
Screenshots/VideosAndroid: NativeAndroid: mWeb ChromeiOS: NativeiOS: mWeb SafariMacOS: Chrome / SafariMacOS: Desktop |
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
🚀 Deployed to staging by https://github.com/neil-marcellini in version: 9.0.20-0 🚀
|
FYI I believe this was deployed to prod yesterday, from this checklist - #47356 |
if (reportID) { | ||
const reportNameFromCache = reportNameCache.get(cacheKey); | ||
|
||
if (reportNameFromCache && reportNameFromCache.reportName === report?.reportName) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👋 Coming from #47405
This has caused a small bug where DM header wouldn't show after you clear the cache, since reportNameCache
is an empty string after you do it
We resolved this by returning early if reportNameFromCache.reportName
is not an empty string
Looks like this PR caused the following issue: because when the cache for report name is cleared, members room names are not updated in LHN - showing |
Details
This PR improves performance of
getReportName
function by adding cache mechanism to store report names byreportID
, eliminating redundant computations for frequently used reports.It the latest Jason trace
getReportName
took 1.2 s. With these changes we should reduce that number by ~35%-45%. I tested it locally in a small account and was able to reduce total execution time of this function from ~6ms to 3.4ms.Fixed Issues
$ #45528
PROPOSAL:
Tests
Offline tests
QA Steps
PR Author Checklist
### Fixed Issues
section aboveTests
sectionOffline steps
sectionQA steps
sectiontoggleReport
and notonIconClick
)myBool && <MyComponent />
.src/languages/*
files and using the translation methodSTYLE.md
) were followedAvatar
, I verified the components usingAvatar
are working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG)
)Avatar
is modified, I verified thatAvatar
is working as expected in all cases)Design
label and/or tagged@Expensify/design
so the design team can review the changes.ScrollView
component to make it scrollable when more elements are added to the page.main
branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTest
steps.Screenshots/Videos
Android: Native
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari
recording.mov
MacOS: Desktop