-
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
Created migration to change ONYX resource personalDetailsList to COLLECTION #30333
Created migration to change ONYX resource personalDetailsList to COLLECTION #30333
Conversation
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.
Hey @sebryu, appreciate the update
I have a question regarding the new structure where personal details are stored as a collection. Does this mean that each entry in the personal details will now have its own unique key?
I'm asking because my High Traffic account currently has 4136 entries in the list of personal details. At present, there are approximately 152 unique keys after I log in. With the new changes, this number would increase to 4288 unique keys. Could this potentially impact the performance of the getAllKeys
method in Onyx?
Benchmarking how number of personalDetails keys length correlates to commits/component render duration. (cc: @marcaaron ) Number of keys: 100 Number of keys: 250 Number of keys: 500 Number of keys: 1000 Number of keys: 2000 So I would say that from personalDetailsList with keys count between 250-500 problems starts to be visible. |
@kidroca Benchmark on how number of unique keys in Onyx correlates to speed of Onyx.getAllKeys(): Number of keys: 100 - 0.02ms Moreover when clicking through the app with big collection (16k keys) I haven't noticed any performance decrease. |
Good stuff @sebryu thanks for the benchmarks! @mountiny I am not too sure how we would go about doing a migration for this if we really wanted to switch over. While there's not so many places in the backend where we need to change this (< 20 or so). The problem is that there's not really anyway to verify at the moment which clients should get the new format vs. the old. So, while I am interested in this idea, we just don't have a clean way to change it because the API is not versioned, subscribers to the data receive things that are not versioned, there could be "missing updates" in a format that they can't use. I guess we could send both formats and have newer clients ignore the old and old ones store useless data. But that is not satisfying. All that leads me to think we need to have some larger conversation about how the API interacts with the App and how a migration like this could work longer term. For now, one workaround is that we might be able to do a pure front end solution... We could:
This might come with a downside of being slightly confusing, but would solve the problem without having to crack the migration problem. |
I am sure this is challenging, but I was wondering if we could actually do this the other way around, hence make the App code compatible with both collection version and still the old version of the personal details format. This might come in with some slowdown when we check if the new format is available and if not just use the exisiting code without change. Currently I need to work on an external commit for the Bottom up flow so cant really explore this much, but I feel like there should be a way @sebryu such that the App code will just continue using the existing array format and once we deploy this leave it out for maybe a week to ensure there are 3-4 versions of the app which have a support for the new format, we can then switch over the API to return the collection format and with migration all should work fine. However, not sure how feasible this is from App code perspective. |
It definitely needs an internal champion. Sorry, I have too many things in my backlog already so can't help right now. |
….COLLECTION personalDetails - optimized BaseUserDetailsTooltip
af9f612
to
441d996
Compare
Same we will try to call out for help in the weekly update |
I think we can close this PR for now |
Created migration to change ONYX resource personalDetailsList to ONYX.COLLECTION personalDetails - optimized BaseUserDetailsTooltip.
I still need to change other
personalDetailsList
occurrences, but I'm submitting this draft for opening a discussion.Details
In many benchmarks on High Traffic account a lot of time is generated by processing of huge
personalDetailsList
resource from Onyx (visible on BaseUserDetailsTooltip component on screen transition / typing / cmd + k).I've migrated Onyx resource
personalDetailsList_
to a collectionpersonalDetails_
, which allow us to make small components to subscribe only to resource they need (by using withOnyxkey: ({accountID}) => COLLECTION + id
).Below I'm attaching benchmarks for following scenario - on HT account on report screen focused input and pressed cmd+k.
We can see that on avg. it takes:
withOnyx(personalDetailsList)
component) for main branchwithOnyx(personalDetailsList)
component) for main branch on x6 cpu slowdownwithOnyx(personalDetailsList)
component ) for this branchwithOnyx(personalDetailsList)
component) for this branch on x6 cpu slowdownResults
500% faster for whole commit, and just 5000% faster (or 30000% faster on x6 cpu slowdown) for rendering single BaseUserDetailsTooltip component
Fixed Issues
$ #30318
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 methodWaiting for Copy
label for a copy review on the original GH to get the correct copy.STYLE.md
) were followedAvatar
, I verified the components usingAvatar
are working as expected)/** comment above it */
this
properly so there are no scoping issues (i.e. foronClick={this.submit}
the methodthis.submit
should be bound tothis
in the constructor)this
are necessary to be bound (i.e. avoidthis.submit = this.submit.bind(this);
ifthis.submit
is never passed to a component event handler likeonClick
)StyleUtils.getBackgroundAndBorderStyle(themeColors.componentBG)
)Avatar
is modified, I verified thatAvatar
is working as expected in all cases)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
MacOS: Desktop