Java built-in data types (performance issues)
by, 11-06-2011 at 06:29 PM (1794 Views)
Java built in data types provide programmers ease of storing their required data in appropriate data type. But in come cases, it may become a bottleneck. When doing low level related work, the speed is very important. In such case don't use the Java built-in data types.
Lets take an example. If you are using an Integer class, just think of all the overhead you are creating by using the wrapper class. One rule of thumb is to use the primitives instead of wrapper. This will guarantee better performance. In our daily life, we do not consider using unsigned int or unsigned long because Java application that we are creating are fast enough and we donít really care about such things.
Performance is of concern when you are dealing with databases. In such cases, you should be using primitives to achieve speed and performance. They manipulate the bits directly which gives the max possible performance.