-
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
perf: reduce loops in getValidOptions / separate to getValidReports #55298
perf: reduce loops in getValidOptions / separate to getValidReports #55298
Conversation
All contributors have signed the CLA ✍️ ✅ |
This is also a separation needed for future performance improvements
6366b10
to
ebb9dc6
Compare
I didn't had the time to record videos for all platforms - grateful for if the reviewer could help here - thanks! 🙏 |
@allroundexperts 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] |
Reviewer Checklist
Screenshots/VideosAndroid: NativeScreen.Recording.2025-01-20.at.7.05.16.PM.movAndroid: mWeb ChromeUnable to make the android web work iOS: NativeScreen.Recording.2025-01-17.at.6.52.33.AM.moviOS: mWeb SafariScreen.Recording.2025-01-17.at.6.35.41.AM.movMacOS: Chrome / SafariScreen.Recording.2025-01-17.at.6.23.56.AM.movMacOS: DesktopScreen.Recording.2025-01-17.at.6.32.34.AM.mov |
isAdminRoom as reportUtilsIsAdminRoom, | ||
isAnnounceRoom as reportUtilsIsAnnounceRoom, | ||
isChatReport as reportUtilsIsChatReport, | ||
isChatRoom as reportUtilsIsChatRoom, | ||
isGroupChat as reportUtilsIsGroupChat, | ||
isMoneyRequestReport as reportUtilsIsMoneyRequestReport, | ||
isOneOnOneChat as reportUtilsIsOneOnOneChat, | ||
isPolicyExpenseChat as reportUtilsIsPolicyExpenseChat, | ||
isSelfDM as reportUtilsIsSelfDM, | ||
isTaskReport as reportUtilsIsTaskReport, |
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.
Why are you adding reportUtils
prefix to some of these?
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.
I believe they might conflict with existing variable declarations? I've seen more and more of this since now we don't allow importing the whole lib. Although usually people add it as a suffix.
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.
That being said, I think that if it doesn't conflict with existing variables, we should just drop the prefix and import the method as is.
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.
It is conflicting with existing function names in that file, or with variable names, hence I prefixed it.
I wasn't able to see any distinguishable difference in the time for |
How big was the account you tested? I imagine the difference is noticeable only in large accounts? |
Co-authored-by: Carlos Martins <[email protected]>
Note: the performance gains on that PR might not be very noticeable. Its a first PR in a row of cleanup + performance improvement PRs (didn't want to throw it all into one PR, see this comment for a step plan) // Edit: here is a next PR which is based on this one, where we can see a clear ~10% improvement for open search page metric: #55460 |
It wasn't very large. |
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.
Works good!
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.
LGTM
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
This is also a separation needed for future performance improvements
Explanation of Change
From: https://margelo.slack.com/archives/C05LX9D6E07/p1736955126451729
This is a first of many performance optimizations for the search.
This simply consolidates many loops we had for filtering reports and personal details into just one loop for personalDetails and reports. The performance gains aren't crazy here, but it's a first step.
This also helps with cleaning up the function a bit for future performance improvements!
I ran reassure on the main branch and on this and got the following results:
Fixed Issues
$ #46590
PROPOSAL:
Tests
Offline tests
QA Steps
Same as testing
PR Author Checklist
### Fixed Issues
section aboveTests
sectionOffline steps
sectionQA steps
sectiontoggleReport
and notonIconClick
)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
CleanShot.2025-01-16.at.12.39.29.mp4
iOS: Native
CleanShot.2025-01-16.at.12.39.29.mp4
iOS: mWeb Safari
CleanShot.2025-01-16.at.12.39.29.mp4
MacOS: Chrome / Safari
CleanShot.2025-01-16.at.12.39.29.mp4
MacOS: Desktop
CleanShot.2025-01-16.at.12.39.29.mp4