-
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
[Tracking] Callstack performance audit of the App #33070
Comments
Adam from Callstack here, I'd like to work on this. |
This is a performance audit of the Expensify app done by Callstack, following the DMAIC methodology. It will consist of 5 phases and result in a report summarising the whole audit. In the first phase we have defined the following metrics:
|
Current status:
We've conducted the measurements (will post shortly) and are finishing up analysing them, you can expect separate comments with the findings. |
Metric: JS bundle size in MB
|
Metric: JS bundle size in MB Below is the breakdown of our findings from the analysis process. To sum this up, if we take the associated actions the JS bundle size can be reduced by at least ~11%.
Unused / deprecated / vulnerable dependenciesAdditionally, some unused/deprecated/vulnerable dependencies have been identified in the process.
|
@mountiny Happy 2024!! 😊 |
Metric: APK Size in MB Measurements:Baseline:We gathered the following metrics on baseline ( without any improvements ) :
These metrics are gathered by generating a release APK using
If we take metrics for one architecture like
Given that, if we are able to reduce the size of the APK for all architectures, it's perceived that each architecture separately would benefit from it. |
Metric: APK Size in MB Optimisations Round 1:We will start with enabling the Proguard and removing any resources that aren't used in the app and in the app's library.
Once this is done, we will measure the affect of it on the APK:
The above measurements uses the default With Optimisations Round 2:We applied all the optimisations from previous round with one change. And that’s we used the default
This is a great result, saving around 10-11 MB as compared to the results in Measurements phase, seems like magic 🪄 There are other things to consider here:
|
Ok, this is very interesting, since we have a best practice in place that we should do When we introduced this best practice, I thought that we determined it would not have an effect on bundle size because babel would strip out the unused imports and end up only importing the named imports that are actually used in the final bundle. If this is not true, then I'd surmise that our current best practice might actually a bad practice? In short, I agree with the change to use default imports from the |
I'm all for removing any polyfills we don't need anymore. Just keep in mind all the JS engines we're exposed to – not only Hermes but also the modern browser landscape. |
This is already happening with the TypeScript migration, so 👎🏼 to any new coordinated effort to ditch underscore for now. Once all files are migrated to TypeScript we should have no more uses of underscore, at which point it can be removed. |
Nah, let's just stick with svg. |
It's not clear what impact this would have, positive or negative. So unless there's some clear improvement can be made, and it's shown to be significant "worth it", I don't think we should discuss this. Also, I know in the future we'll want to support custom emojis, that would probably be a better time to discuss overhauls of our emoji implementation. |
Yeah, sounds good. We should probably think about "chorifying" that – i.e: creating a recurring chore, say, every month or every quarter, that's assigned to someone to run This would be a good one to bring to slack with a problem/solution. We already have robust code for creating and auto-assigning chores, so that part is pretty trivial if we agree that this would be a valuable chore to introduce. Would be a happy to discuss a P/S about this in slack. But yes, in the meantime we can patch known vulnerabilities, but I want to make sure that proper testing is happening so we should manually upgrade them one-at-a-time and thoroughly test relevant functionality, rather than upgrading them all in one fell swoop with |
👍🏼👍🏼 to removing any unused dependencies, but I'm skeptical of your analysis. For example, Maybe it would make sense to create a separate |
This change is already included in the 0.73 upgrade PR here, so I think we should be covered there. |
Unfortunately I'm not familiar with this Android thing. Are there any potential downsides? Edit: Honestly, this makes me a bit nervous:
It sounds like it could be a common source of development headaches in a code space (i.e: Android native bundling) that most React Native developers (myself included) aren't accustomed to thinking about. So I'm not sure if I'm on board or not. I'm not sure 10MB in the native bundle is worth it – does it have any effect on startup time? Reducing the JS bundle size seems more worth it because it will mean the website will load faster. |
Hey @mczernek @staszekscp – curious if you have any experience with or recommendation regarding enabling Proguard? |
On the one hand, proguard is as natural as air in native Android development - using it is natural and standard pattern once you go to production. On the other, I don't see gains being huge here and yet I can see some risks. Since proguard is not so natural in RN ecosystem, some libraries might not be ready for it. There are cases when it can actually delete used code and resources if they are not referenced directly. As mentioned that would require extensive testing of whole app - risk it breaks something might not be huge, but it might happen pretty much anywhere. Being completly honest, with RN apps I usually do one of two - enable proguard from the very start of development or just skip it altogether. However, being huge app we want to become, I think it might be viable to go through this at some point. |
TBH, a couple of months ago we've enabled proguard with Michał in order to check if it gives some performance gains on app startup time. The app booted, but we didn't see any difference in performance (also navigating between screens). Because of the risks Michał has mentioned above, we have decided that it is not the path it is worth to take. 😄 However, the app has changed a lot since, so it may be worth to check again. |
@roryabraham @staszekscp @mczernek These are some really valid points brought up and I agree with almost all of them. I would like to discuss a few things in detail:
- Enabling ProGuard in React Native: As mentioned, some libraries aren't supporting ProGuard which makes it hard to enable it. I have had issues with ProGuard previously but in case of Expensify, things were pretty smooth. Mostly because
- Is Improving Native Bundle worth it: Yes, the reason is related to the growth of the brand itself. It's proven that the apps with larger size face the most uninstalls than the one's with lesser size. You might know it already but stating just for the sake of it. This goes hand in hand with JavaScript Bundle size but we have different techniques to reduce it. For example, the size of an APK with What should we do? Since we have a dedicated effort going on for performance audit and improvements, I would suggest we should try this and conduct a regression of the app and see if it negatively affects the app. By negatively I mean if it makes the app unusable by throwing ANRs, crashes or reducing the app functionality. If there's no such case or we are able to fix it if there is, then we are good to go with using ProGuard. |
Thanks @roryabraham and everyone else jumping in. I agree with Rory's assessment, I think you know the hustle by now, we dont really like to do thing just for sake of doing them/ unless there is a clear reason/ benefit for us so we should skip doing those where this is not clear or negligeable. In therms fo Proguard, I am on the same boat, I am not familiar with the complexities of this change, seems like everyone who is familiar with it agrees we should do it, but maybe not now. That feels like we can maybe put it on LOW in terms of priority and come back to it once we get some more significant improvements in. Or would you say this is one of the best improvements we can get now? |
Perfect, thanks for bringing this. Since we're (only) auditing the current state, we had to point out any of the improvements - even the ones that are currently ongoing. Let's skip it then! |
Absolutely - we can bundle these separately based on the platform ans reduce the size only where it's really possible. Should we treat this as an action item for the next phase? This can potentially shave off ~3% on mobiles. |
Noted! Let's skip this part then. Mind sharing the reasoning behind it so we can make it clear for the future and not revisit this later? Is it just the quality or other aspects also play a role here? |
Triggered auto assignment to @neil-marcellini, see https://stackoverflow.com/c/expensify/questions/7972 for more details. |
Why was I assigned here? To review PRs? |
This is just a tracking issue @neil-marcellini |
This issue has not been updated in over 15 days. @mountiny, @adhorodyski, @muttmuure eroding to Monthly issue. P.S. Is everyone reading this sure this is really a near-term priority? Be brave: if you disagree, go ahead and close it out. If someone disagrees, they'll reopen it, and if they don't: one less thing to do! |
@adhorodyski @muttmuure @mountiny I know that this is just a tracking issue, should we close it out as we're approaching the conclusion of this performance audit and starting another? Do we need a tracking issue or should we just use the #newdot-performance slack room for tracking? |
I think we can close this one and just use the slack room for faster iteration, we can create some new tracking issue for the tracking v2 or a project board once we have specific issues just to be able to better track them however, that would be done once we have the specific issues created |
Tracking issue for @adhorodyski and Callstack team performing performance audit of the app.
This is a performance audit of the Expensify app done by Callstack, following the DMAIC methodology. It will consist of 5 phases and result in a report summarising the whole audit.
In the first phase we have defined the following metrics:
The text was updated successfully, but these errors were encountered: