Encyclopedia > Optimization of Java

  Article Content

Optimization of Java

This Optimization of Java is a collection of optimization techniques used in Java programming language.

Reduce a number of object creations

In Java, object creations are so expensive compared with other compiled object-oriented programming language. It is because in Java, object creation involves:
  • memory allocation[?] from heap, which may cause garbage collection when free space is insufficient.
  • calling constructures

Eliminate simple methods such as accessor method

Because Java compiler cannot be completely sure about which method will be called before runtime, each method call involves looking up a method. Use of small and simple methods that are called frequently can be quite expensive. If possible, embed code of such method directly to the point of call.

Myths There are some myths in performance tuning of Java programs.

  • final modifer with methods or classes reduces the overhead of call of methods - Because the Java compiler cannot know which class will be loaded at runtime, it cannot in-line-expand[?] the methods regardless if they have final or not.



All Wikipedia text is available under the terms of the GNU Free Documentation License

 
  Search Encyclopedia

Search over one million articles, find something about almost anything!
 
 
  
  Featured Article
Great River, New York

... family size is 3.36. In the town the population is spread out with 29.0% under the age of 18, 5.0% from 18 to 24, 29.0% from 25 to 44, 24.2% from 45 to 64, and 12.7% ...

 
 
 
This page was created in 26.9 ms