-
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
[Performance] Onyx usage in withLocalize
adds a significant overhead
#4268
Comments
Triggered auto assignment to @mountiny ( |
Issue created per the discussion here: #4253 (comment) |
@kidroca 👋 Since this is a Thank you very much and have a great day 🙌 |
@mountiny |
Triggered auto assignment to @JmillsExpensify ( |
@kidroca Feel free to start working on this. Performance is very important to us right now. Jason should be able to create the Upwork job for you 🙌 Let me know if you will need help with anything! |
Thanks, I just needed the green light cc @arielgreen |
@kidroca Ah, you are right, I was not aware of this. I believe that is the way to go. Is that right, Ariel? :) Thank you for confirming! |
Yep, @kidroca, that's perfect. Thanks. |
I've pulled the latest changes and captured new "PRE" benchmark information. hash: f856107 Legend
Android Before
Android After
iOS Before
iOS After
Edit: Added "After" benchmarks and reordered for easier comparison |
Added the new "After" benchmarks as well I've benchmarked |
Out of curiosity, is this the same benchmark for iOS and Android? Is it safe to say Android is roughly 2x slower overall? What is the major cause of the 2x slowdown? |
Yes, it's the same test for both platforms
|
I wonder if there is anything in particular, whether it's storage or
something, that is making up the bulk of the performance difference between
the two platforms that are in emulation.
…On Sat, Jul 31, 2021, 12:06 PM Peter Velkov ***@***.***> wrote:
Yes, it's the same test for both platforms
These are physical devices
1. my iOS is much newer - 11 Pro, while the Android is older 2016
Samsung Galaxy S7. On emulators the times are closer, though iOS still wins
2. Native implementation - the implementation in Java is not
necessarily the same as in Objective C or swift
3. Javascript Engine - I've heard the JS engine used on iOS is faster
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#4268 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAEMNUWUK2FURZYEJ5WRYXDT2RCSTANCNFSM5BDYOO7A>
.
|
As far as emulation goes, my understanding is that iOS will be faster because Xcode compiles for x86 and Android Studio emulates ARM. |
Oh yes that seems a big difference
…On Mon, Aug 2, 2021, 9:29 AM Marc Glasser ***@***.***> wrote:
something, that is making up the bulk of the performance difference
between the two platforms that are in emulation.
As far as emulation goes, my understanding is that iOS will be faster
because Xcode compiles for x86 and Android Studio emulates ARM.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#4268 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAEMNUTWDZMSNE4U5TT7GU3T23BXVANCNFSM5BDYOO7A>
.
|
If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!
What performance issue do we need to solve?
e.g. memory consumption, storage read/write times, React native bridge concerns, inefficient React component rendering, etc.
This component is one of the most used components and has more than 310 instances depending on chat size
The current way that the HOC works is that it will make a new Onyx connection per each
withOnyx
instance.A benchmark reviewed that for a large chat the we're spending about 50sec for the
Onyx.get
related to retrieving thepreferredLocale
What is the impact of this on end-users?
List specific user experiences that will be improved by solving this problem e.g. app boot time, time to for some interaction to complete, etc.
List any benchmarks that show the severity of the issue
Please also provide exact steps taken to collect metrics above if any so we can independently verify the results.
I'm using Onyx.printMetrics() to monitor the Onyx.get calls that happen during init: https://github.com/Expensify/react-native-onyx#benchmarks
Results
preferredLocale
)Setup
Using this Expensify/App hash: b2582f3
Modify this file:
src/Expensify.js
Onyx.init
addcaptureMetrics: true
global.Onyx = Onyx;
Modify
src/libs/Navigation/AppNavigator/MainDrawerNavigator.js
getInitialReportScreenParams
always return the same reportreturn {reportID: '71955477'};
Start the app and connect with Flipper or a Hermes Debugger
Steps
Onyx.printMetrics({ format: 'string' }})
when it starts to return the same value - everything is loadedOnyx.printMetrics({ format: 'csv', raw: true })
Proposed solution
Extract a
LocaleContextProvider
that wraps theApp
- the implementation would be pretty much identical to how theclass WithLocalize
works at the moment:App/src/components/withLocalize.js
Line 49 in ad77386
The difference would be that it will
render
aReact
ContextProvider
componentNow only the top level component that wraps the
App
subscribes to OnyxThe HOC
withLocalize
changes to use aLocaleContextConsumer
It uses the context to get translation related props and pass them to the
WrappedComponent
Everything else stays the same
List any benchmarks after implementing the changes to show impacts of the proposed solution (if any)
Note: These should be the same as the benchmarks collected before any changes.
I've done a quick test to verify there will be a significant reduction in
Onyx.get
time. It's demonstrated in the initial changes in the PR here: #4253Platform:
Where is this issue occurring?
Version Number: 1.0.80-2
Logs: https://stackoverflow.com/c/expensify/questions/4856
Notes/Photos/Videos: Any additional supporting documentation
Expensify/Expensify Issue URL:
View all open jobs on Upwork
The text was updated successfully, but these errors were encountered: