Performance optimizations for Java

Source: Internet
Author: User

Method areas in the JVM:

The Permanent zone---information about the stored class. Method. Constant. static variables

Performance optimization for 1.Java

1. Reduce GC pressure, priority is lower than the thread, he is a daemon thread

Reclaim our heap of memory.

2. Try to avoid our new operation

1.string,stringbuffer,stringbuilder

String immutable length of the class an immutable character array.

2.for foreach while iterator.

The type array after foreach and this efficiency is the slowest one in later code is best used for loops

3. Use the basic data type as much as possible.

4. Use local variables as much as possible.

5. The fewer code in the synchronization code block, the better

6. Multi-use final cosmetic class. Prevents the method from being overridden.

Performance optimizations for Java

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.