In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article introduces how to understand the performance optimization skills in Android programming development, the content is very detailed, interested friends can refer to, hope to be helpful to you.
The normal process of performance optimization is to find that there is a big gap between yourself and the competition, such as UI rendering speed, you need to find out why it is slower than others in some way, and you often need to use some tools, and then you can do some targeted tuning (code optimization, implementation change, etc.). Of course, there will be some general tuning methods that can help you in the tuning process.
Therefore, from a general point of view, this paper mainly introduces the detection tools and tuning methods for the above five aspects.
1. Optimization of App startup speed
For App startup speed optimization, we generally use the theme to prevent white screen; for slow startup speed, we need to reduce as much as possible the things to be done in Application's onCreate, such as unimportant SDK latency or asynchronous loading; in the case of multiple processes, we must be able to distinguish processes in onCreate to do some initialization work; some of the classes that will be used will be loaded asynchronously There are also specifically optimized for multidex (of course, with more and more devices above 5. 0, the impact is not so great).
Of course, in the detection startup optimization, in addition to using the adb command to detect the total time, there is also to find time-consuming methods, you can use TraceView, or open StrictMode, if you like to use Log, you can also use hugo, or write a similar AOP log framework.
StrictMode is relatively simple, do not describe, hugo is a Jake god of an open source library, mainly using aspectJ, the source code is very little, but also relatively simple, but good to use, just look at readme is enough.
2. UI fluency optimization
When it comes to UI fluency, generally speaking, do not do time-consuming operations in the main process, improve the rendering speed of UI (reduce the layout level of View, avoid over-rendering, etc.). TraceView, Lint, Hugo, StrictMode, etc.
Of course, for UI Catton, it is inevitable to introduce a detection scheme: there is generally a log of monitoring Looper.
3. Memory optimization
Memory optimization is mainly to eliminate memory leaks and avoid memory jitter in applications; common tools are AS's own memory detection, which can find memory jitter very well; leakcanary can easily help us find memory leaks; MAT can do more memory analysis.
4. Apk slimming down
Apk slimming is mainly done in the following ways:
Using ProGuard compressed code to remove useless resources
Andresguard further compresses and confuses resources
The slimming of the third-party open source library, keeping only what you need.
Image compression of * * and the use of webp
Reasonable configuration to remove unnecessary configuration, keep only Chinese configuration and so on.
Optimization and configuration of so, leaving only a class of so
Dynamically distribute some resources: font, so, skin change bag, etc.
Only 7 of the above are troublesome and require the cooperation of the server. In addition, for dynamic distribution of So, you can refer to the code for hot repair of So by tinker.
5. Electricity quantity optimization
Power optimization actually pays less attention to it. In general, it is reasonable to use some sensors, use Wake Lock cautiously, and reduce unwanted operations in the background. Battery-historian can be used for detection.
Well, you can record the actual optimization strategies used in each solution, and you must experience the tools mentioned in each way. It will certainly not be so difficult to use, and you will be more impressed.
Performance optimization is not difficult, it is important to go to the actual operation, which is basically a common question in the interview.
On how to understand the Android programming development of performance optimization skills to share here, I hope that the above content can be of some help to you, can learn more knowledge. If you think the article is good, you can share it for more people to see.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.