fourthyuga Technologiesfourthyuga Technologiesfourthyuga Technologies
info@fourthyugatech.com
+1 5714749641
United States , India

Best Ways To Make Your Java Application Run Faster

java

Best Ways To Make Your Java Application Run Faster

 

Use  Primitive Types Wherever Possible

Usage of primitive data type over object is better since the primitive type data is stored in stock memory and the objects are stored in heap memory

Aviod Using BigInteger And Big Decimal Class

BigDecimal class provides accurate precision for the decimal values. Over usage of this object hampers the performance drastically specifically when the same is used to calculate certain values in a loop.

Aviod Getting The Size of the collection in the Loop

While iterating any collection get the size of the collection before loop and never get it during iteration.

Aviod Writing Long Methods

The methods should not be too long and should be specific to perform single functionality. Use single Responsibility principle while writing code.

Aviod Using string Objects For Concatenation-

A string is an immutable class the object created by string cannot be reused. so if we need to create a large string it is bad practice to concatenate the string object using the ‘+’ operator

Aviod Use Of Multiple if – else statements

If we are using too many conditional if- else statements it will impact performance since JVM will have to compare the conditions each time.

 

 

Previous Post
Newer Post

Leave A Comment