Android traceview performance analysis and performance optimization

Source: Internet
Author: User

My article on TraceView performance analysis is translated from the official website. The translation address is on the eoe board wiki:

Http://wiki.eoeandroid.com/Profiling_with_Traceview_and_dmtracedump

Performance Optimization should begin with the following basic points:

1. Avoid creating unnecessary objects and do not frequently create objects.

For some operations, try not to create a wearing object if you can. Creating an object is time-consuming and occupies space.

2. If a method does not use member variables, the method can be declared as static, improving the performance by 15%-40%.

You can define all methods as parameter passing methods so that the member variables are not used and the value of the member variables can be modified.

3. If you do not use getter or setter to set the attribute to public, you can directly use and modify the attribute value to improve efficiency.

However, we need to weigh the balance between access control and efficiency.

4. Try to use an enhanced for loop.

5. When a private internal class needs to access the attributes of an external class, the access character of the attribute is set to intra-package access without a modifier.

In this way, you do not need to wear a copy in the internal class.

6. Use as few floating-point operations as possible to accelerate integer operations

7. Reasonable Use of reflection.

8. We recommend that you use jni to call c code.

9. listview Optimization

..................

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.