Java inline functions

Source: Internet
Author: User

1. The inline function means that the function is directly expanded where it is called, and the compiler does not need to be used as a general function, the parameters are stacked, the parameters are pushed back and the resource is released, etc., which improves the program execution speed.

There is a keyword final in the 2.Java language to indicate that the function is inline, for example:

Public final void DoSomething () {
To do something
}

When called, the method will be used directly at the call, thus increasing the execution speed of the program. In addition, the final keyword has a role to prevent dosomething methods from being overwritten in subclasses, and if you want DoSomething to be a final act, it should be designed as final.

Inline is not necessarily good, when the method body that is specified as an inline is large, the overhead of the expansion may have exceeded the time of the normal function call, and the introduction of the inline has reduced performance because it should be prudent to select this keyword, but in later versions of the JVM the optimizations were made when the inline was processed. It determines whether the call is expanded based on the size of the method.

Java inline functions

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.