Android Startup time Slow issue

Source: Internet
Author: User

"Turn" for Android performance this aspect of the evaluation, most of them have super rabbit to run points, or do not reflect the overall problem. As far as I know, application startup time is a performance issue that affects the user experience.
A recent project, others said the application started slowly, my teacher see me nothing, asked me to look. I have seen it once, but when I was studying, I just looked at how the whole process was going, and this time it was different. The beginning of the day, according to the previous way to look again, feel there is no unusual place, but the time is indeed much slower than the comparison machine, but do not know what is the time to send a piece. From Inputreader to Viewrootimpl, from Viewrootimpl to Lanucher startactivity, to show activity from launcher to Activitymanagerservice, The whole process went through, did not find abnormal place, small depressed a bit.
The next day to think about, feel wrong, their own comparison of the way there is a problem, did not slow the phone with the contrast machine are the same operation, leading to know the time is slow, do not know where the slow, so, two mobile phones I have only into the phone interface, and in two mobile phones have been playing log, found that the slow phone is better than the phone slow 200~300ms, I compared the whole time, found in the AMS Scheduler to displayed Activity time is particularly long, to determine that period is that period.
In fact, this process has a lot of steps, to the original activity OnPause off, press into the activity Stack, and then in the new activity shows that the entire activity life cycle has gone, this let the group I love why Ah! Did not recruit, had to use a sub-way, continue to play log.
After hardships, finally found in Activitythread.java minstrumentation.callactivityonpause (r.activity) time is the longest, normal that model is not time, and slow the phone, Really want to 200~300ms, just is the whole cycle slowed down time, is lanucher in onpause time slow down, in charge of Lanucher colleague asked, recently launcher changed what, only found, launcher in onpause time, Do live wallpaper colleague, added the screenshot of the Code, to intercept the Lancher item, in order to display it.
After two or three days of tossing and turning, I got a result, and I was lucky to find out the problem. Do the performance of all said, the environment must be the same, I also know, unfortunately do not necessarily will be implemented, or the first day will not be white busy! There is a point is important, the original dichotomy is really so God, never found before, this time himself is used, the effect is quite good! Turn the problem of O (n) into O (Lon), it seems that the efficiency will really increase greatly!
Recently on the Android GUI is very keen, hope that their own good study, can understand, heard is the most complex Android piece, tube him, play it! OnCreate OnStart OnPause need to analyze exactly which life cycle has spent the most time

Android Startup time Slow issue

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.