-
Notifications
You must be signed in to change notification settings - Fork 87
perf: speed up collection reads in tryGetCachedValue #678
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: speed up collection reads in tryGetCachedValue #678
Conversation
|
I just encountered a couple of failing tests in the E/App when testing this branch, lets hold with the review |
|
I fixed one test suite, looks like the rest is coming from 2.1.135 version - |
|
@Pujan92 can you please test this change in App? |
|
@TMisiukiewicz just to understand, is this optimization for those collection where the data might not be available and is undefined(like for those undefined we want to avoid the search loop for every useOnyx )? Bcoz I think for the common collections( react-native-onyx/lib/OnyxUtils.ts Lines 534 to 539 in 27f8a11
|
|
@Pujan92 before, |
|
Bug: Toggling the language preference back doesn't apply to the application. Screen.Recording.2025-08-25.at.19.26.46.mov |
Screenshots/VideosAndroid: HybridAppap1.webmiOS: HybridAppSimulator.Screen.Recording.-.iPhone.15.Pro.-.2025-08-26.at.12.09.03.mp4iOS: mWeb SafariSimulator.Screen.Recording.-.iPhone.15.Pro.-.2025-08-26.at.12.11.04.mp4MacOS: Chrome / SafariScreen.Recording.2025-08-26.at.11.34.06.movMacOS: DesktopScreen.Recording.2025-08-26.at.12.02.07.mov |
Pujan92
left a comment
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.
App works well
|
The only point is that earlier we used to store the collection member keys to the collection index but now we are storing the values in the collectionData. So the memory usage may increase. |
mountiny
left a comment
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.
Thanks, changes look good to me! @AndrewGable do you want to review?
Details
Related Issues
$ Expensify/App#68908
Automated Tests
As it is a pure performance optimization, no tests are needed. Performance tests running on CI in this PR shows improvements to
tryGetCachedValue.Manual Tests
Author Checklist
### Related Issuessection aboveTestssectiontoggleReportand notonIconClick)myBool && <MyComponent />.STYLE.md) were followedAvatar, I verified the components usingAvatarare working as expected)/** comment above it */thisproperly so there are no scoping issues (i.e. foronClick={this.submit}the methodthis.submitshould be bound tothisin the constructor)thisare necessary to be bound (i.e. avoidthis.submit = this.submit.bind(this);ifthis.submitis never passed to a component event handler likeonClick)Avataris modified, I verified thatAvataris working as expected in all cases)mainbranch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTeststeps.Screenshots/Videos
Android: Native
android.mov
Android: mWeb Chrome
iOS: Native
ios.mp4
iOS: mWeb Safari
ios-web.mp4
MacOS: Chrome / Safari
web.mov
MacOS: Desktop
desktop.mov