As soon as I joined the company, I optimized the ancestral code, improved the stability of the APP by half, and greatly improved the user experience. What is the experience?

A word! Cool!

This is no better than fighting xiao Yan inside the “three years of” face sweet to cool? No more than the bo people spread fire? Cool novel dare not write so.

The point? No one believes me.

A pig who eats a tiger

Last year, I met an interesting friend in the interview of Jinsanyinsibang company. He was an Android programmer with a junior college degree and non-professional background.

After entering the company, the young man hit the ground running. In the third month, he made some small optimization on the pile of ancestral codes of our company, which improved the stability of the APP by half and greatly improved the user experience. It was a surprise, praised by the leadership and our technical group, directly exempt from examination and transferred to a full-time position.

Peacetime quiet of, originally put here hold back big recruit, say cow not cow break off!! Of course, the rest of the group didn’t agree. They thought it was just luck that he could fuck him.

Performance optimization status

For those of you who have used both Android and iOS, the experience should be obvious: The longer you use Android, the more stuck you get compared to iOS.

In this era of networks pursuing 5G, the “card” experience has clearly become a very low impression.

Therefore, in Android development, performance optimization strategy is very important, he determines the quality of application development, including usability, fluency, stability and so on, is the key to improve user retention.

So, not only Alibaba, but also Tencent, Bytedance, iQiyi, etc., all pay great attention to this question. If you do well in this direction in the interview, you will be worth a lot of money. That’s the main reason the young man had to avoid being tested.

In fact, our products have not been tested before launching. We will also use mainstream tools in the industry, such as Android Studio Profiler, LeakCanary, Memory Analyzer (MAT), Systrace, etc. However, these tools have the following problems:

  • Offline scenes are limited, so it is difficult to exhaust all user scenes. However, after the application goes online, it often fails to be realized because offline scenes cannot be reproduced, users provide insufficient clues and other reasons.

  • On Android, memory snapshot HPORF can be obtained using native debug. dumpHporf. During the dump process, the main thread is suspended, resulting in significant delay. In offline use, the experience is poor, and the sampled data is affected.

  • Whether Systrace or LeakCanary is used, it will cause the program to “change the card”. The analysis process will also affect the memory usage of the process, resulting in deviation of the analysis data, and even affect other performance indicators.

  • The analysis result of the memory analysis tool is relatively simple. It can only analyze Fragment and Activity memory leaks, such as large objects and too many small objects, which cannot be analyzed in OOM.

How are performance problems addressed?

Due to the drawbacks mentioned above, these offline tools can only solve obvious and common problems, but the environment after the application goes live is extremely complex.

First of all, if you are engaged in client development, you should know that the process of solving the lag is often tortuous, and some of them are not as simple and superficial as we think. Most of the time, most of the lag is difficult to find in time, can not reproduce the lag, often appear in the online user’s real use process, this kind of lag is often closely related to the machine performance, mobile phone environment, and even operating preferences and other factors.

It’s hard to get a direct insight into the root cause of the lag from the user’s “nice card” description. Some even don’t know what the scene is, so it’s hard to reproduce it exactly, so it’s kind of confusing.

As one of the most important resources for computer programs to run, memory needs to be reasonably allocated and recycled during the running process. Unreasonable memory occupation may cause the user application to run slow, ANR, or black screen, or cause the user application to crash OOM (out of Memory).

We need to maintain excellent fluency and stability on various machine resources, and memory optimization is a must. However, even if we have access to Bugly online exception collection platform, we cannot guarantee to find the reason of OOM through the exception log. For the vast majority of OOM, the exception log shows the straw that broke the camel’s back, not the direct cause.

The diagram below:The error occurs in the fifth line of B. xf. The cause of OOM is that too much memory is applied for here, too much memory is applied for elsewhere, which leads to insufficient available memory, or the program has memory jitter, which leads to insufficient continuous memory. We don’t know.

In this case, the importance of APM (Application Performance Monitor) is reflected. Wouldn’t it be nice if we could monitor the performance of the application after it goes live and extract the monitoring data when problems occur, so that we can locate the performance problems and solve them quickly?

How to monitor online performance and optimize performance effectively?

In view of the “performance optimization” this point, this paper presents a detailed overview of Android performance optimization, from all aspects of the target product for a full range of “optimization”, so that the product performance from all aspects to improve, I hope you like.

I hope to learn online performance monitoring to improve APP tuning internal work, job-hopping into the big factory friends study hard, seize the time to improve!

I believe that if you read through this document and follow through, you will have the courage to write on your resume that you are familiar with Android online performance monitoring, APP performance tuning and project practice. Shoot down any interviewer who asks you about online performance monitoring and become a real face hog!

App performance optimization points outline

This super full App performance optimization knowledge and skills manual is available721 pages, 4 big points, 25 small chapters, not only a detailed analysis of the underlying principles, but also special practice cases

Friends in need, directClick here to jump to the blue font free access channel!

(In addition, there is a series of supporting performance optimization topic video can be packaged together if necessary)

Chapter one design idea and code quality optimization

  • The six principles

Single responsibility principle Richter substitution principle dependent inversion principle Interface isolation principle……

  • Design pattern: structural pattern

Bridge mode Adapter mode Decorator mode Proxy mode Facade mode……

  • Creation pattern

Builder pattern singleton pattern Abstract Factory pattern Factory method pattern…

  • The data structure

Array stack queue linked list tree……

  • algorithm

Sorting algorithm search algorithm……

Chapter 2 program performance optimization

  • Optimization of startup speed and execution efficiency

StrictMode for APP startup speed and execution efficiency

  • Layout detection and optimization

Layout hierarchy optimization over rendering…

  • Memory optimization

Memory jitter and memory leak Memory monitoring tool Mat Large object and leak detection Power consumption Optimization Network transmission and data storage optimization Network transmission and data storage optimization APK size optimization screen adaptation……

  • Optimize the power consumption

Doze&Standby Battery Historian JobScheduler WorkManage

  • Network transmission and data storage optimization

Google Serialization tool Protobuf 7Z extreme compression……

  • APK size optimization

APK slimming wechat resources confusion principle……

  • Screen adaptation

Adaptation Principle Screen resolution qualifier and smallestWidth qualifier Adaptation Principle Why the smallestWidth qualifier is used and How to adapt it to Other Modules Troubleshooting……

  • OOM troubleshooting principles

JVM memory reclamation mechanism and GC algorithm parsing lifecycle Summary Bitmap compression solution summary……

  • ANR problem resolution

AMS System time regulation principle Program waiting principle analysis ANR problem solution……

  • Crash Monitoring scheme

Java Layer Monitoring Solution Nativie Layer Monitoring solution……

Chapter three optimization of development efficiency

  • Git, a distributed version control system

GIT Branch management in a Distributed Version control System……

  • Automated build system Gradle:
  • Gradle with Android plugins

Gradle Transform API gradle Transform API

  • Basic use of the Gradle Transform API

What is the use scenario of Transform Transform the type of input that the Transform API learns……

  • Custom plug-in development

Customize Gradle plugin buildSrc module approach…

  • The plug-in of actual combat

Multi-channel packaging version of automatic nail……

Chapter 4 APP performance optimization practice

  • startup

General process of application startup Cold startup and Hot startup Startup speed measurement Startup window optimization Thread optimization System scheduling optimization GC optimization IO optimization Resource rearrangement home page layout optimization Class loading optimization Selection of appropriate startup frame reduce Activity jump level Vendor optimization Background preservation…

  • fluency

Some tools and methods to analyze performance problems through performance data analysis of the Performance of the Android platform performance cases caused by the Android App itself performance problems low memory data characteristics and behavior characteristics of the application of IFLYtek input method barrier-free services caused by the whole machine lag analysis bytedance: Toutiao graphic details page seconds practice…

  • The practice of Douyin in APK packet size resource optimization

Image Compression WebP Non-invasive Compatible Multiple DPI Optimization shrinkResource Merge shrinkResource Strict mode Resource confusion (compatible with AAB mode) ARSC Thin…

  • Youku responsive layout technology full analysis

Youku APP responsive layout technology Overview Of Youku APP responsive layout Android landing in the distribution scene landing in the consumer scene landing Youku APP responsive layout test scheme……

  • Network optimization

Mobile taobao in the network link optimization Baidu APP in the network depth optimization practice……

  • Mobile Taobao Double 11 performance optimization project revealed

The implementation of the one-second rule improves startup time and page frame rate by 20% and saves 50% memory on Android phones…

  • Autonavi APP full link source code dependency analysis

Basic Implementation Principles of Autonavi APP Platform Architecture Application Scenarios and implementation Principles of project architecture……

  • Complete the OOM experience sharing

Check for memory leaks. Bottom pocket policy. High memory peak value.

  • Wechat Android terminal memory optimization practice

Activity Leak detection Bitmap allocation and reclamation tracking Native memory leak detection Thread monitoring Memory monitoring……

conclusion

If you want to improve your mobile development performance optimization skills, or are preparing for an interview for a mobile development position, I think this is a great note to miss.

Friends in need, directClick here to jump to the blue font free access channel!