Closed hurali97 closed 4 months ago
Looks great overall. I think we can re-use some existing code.
I'm also curious if the for in loops are really helping performance / memory use or if that was just a preference. Disabling eslint is probably fine because I don't think we'll have prototype properties getting in the way, but let's only disable the rule if there's a good reason.
Comparing the before and after profiles, we get 400ms of reduction if we use for...in
mainly because we are not doing Object.keys
first for target
and second for source
. These numbers are really noticeable on a large data like ~15k reports.
@chrispader @hannojg suggested changes are addressed, would be great to if you guys can re-review 👍
@hannojg do you want to review once more before we merge? @mountiny feel free to go ahead if you want.
🚀Published to npm in v2.0.54
Details
The changes in the PR are part of improving the app startup which was profiled for the native Apps. The main change is explained below, the other changes are self explanatory.
Prior to the following change, we had 2.4 seconds being consumed in the loop. We can improve this by doing a
multiGet
and then doing a loop over returned keys. This reduces the execution time to 250 ms, saving us 2 seconds.Before:
After:
Related Issues
https://github.com/Expensify/App/issues/43746
Automated Tests
Manual Tests
Author Checklist
### Related Issues
section aboveTests
sectiontoggleReport
and notonIconClick
)myBool && <MyComponent />
.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
)Avatar
is modified, I verified thatAvatar
is working as expected in all cases)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
https://github.com/Expensify/react-native-onyx/assets/47336142/a0e2ff33-eb62-45ad-8aed-fb2bddcb18eaAndroid: mWeb Chrome
https://github.com/Expensify/react-native-onyx/assets/47336142/16ab1920-f82f-4b1e-8160-7594bddaa272iOS: Native
https://github.com/Expensify/react-native-onyx/assets/47336142/a215f721-a281-4937-8ba9-931404a353bdiOS: mWeb Safari
https://github.com/Expensify/react-native-onyx/assets/47336142/7f24c6fa-ac8c-482e-842a-1c5f7d778ff9MacOS: Chrome / Safari
https://github.com/Expensify/react-native-onyx/assets/47336142/728ef8b3-86c1-404f-8945-276258902834MacOS: Desktop
https://github.com/Expensify/react-native-onyx/assets/47336142/983b0783-5836-460b-8c26-e5716542f9b9