App startup speed

Source: Internet
Author: User

The trace code found that the white screen at the time of application startup continued until the draw call was completed, and any time-consuming operation in the process would result in a white-screen growth.

1.adb shell am start-w-N yourpakagename/mainactivity

-w:wait for launch to complete here's launch to complete never understood where to go

Pros: Quickly test start-up times and compare to other applications.

But the first page shows a different time.

2.System.currenttimemillis ()

Ben intends to use it to test 1 in the end who is the time, unfortunately, the date +%s%n in Android, can only print seconds, no nanosecond can not display milliseconds.

While other apps can print time before calling the shell, it seems like time is not ready to print until the shell executes. Can not be verified.

2. log.e ("Timerun", "Resume" + android.os.Process.getElapsedCpuTime ());

Printing process run time, and 2, the rapid analysis is not easy, the specific analysis is not working.

3. It's still traceview to know if there's a problem with the program.

Android.os.Debug.startMethodTracing ("Application");

Android.os.Debug.stopMethodTracing ();

Generate/sdcard/application.trace files, use TraceView to open to track time-consuming functions at startup

My program started at more than 1s, found that most of the consumption in the layout and drawing, originally if the layout of each additional large imageview, the above time will be dozens of hundred milliseconds time increments.

And the front in order to match a variety of models, the direct use of 720*720 pictures, backgrounds, masks, and so on has 5 layers, this speed soared ah.

In the future, we will use different sizes for different models. For the large size, I hope that a friend can help guide.

It's best to combine 1 and 3 to analyze it together.

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.