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 use the same function as the normal functions, the reference stack, the return of the stack and the release of resources, and so on, which improves the program running speed.

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

Public final void DoSomething () {
To do something
}

This method is used when it is invoked. is used directly at the call, which increases the speed of the program.

In addition Finalkeyword is another function that prevents the DoSomething method from being overwritten in subclasses. Suppose you want dosomething to be a last act. Then it should be designed as final.

Inline is not necessarily good. When the method body that is specified as inline is very large, the overhead of the expansion may have exceeded the time that the normal function call was called. The introduction of inline instead reduces performance, since it should be prudent to choose this keyword, except that in later versions of the JVM, optimizations are made when dealing with inline, depending on the size of the method to determine whether the call is expanded.

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.