Details
-
Improvement
-
Status: Closed
-
Minor
-
Resolution: Fixed
-
10.10.1.1
-
None
-
Performance
Description
Java 5 introduced some new static factory methods (called valueOf()) in the Number sub-classes, to be used in preference of the constructors unless a fresh instance is required. The valueOf() methods are allowed to cache and reuse objects, possibly reducing the allocation/gc cost and the memory footprint. For example, Integer.valueOf(int) uses a pre-allocated cache for values between -128 and +127 by default (the cache size can be tuned with JVM flags).
Now that the server and client code is compiled against Java 5 libraries, we should use the valueOf() methods to get those benefits. Note also that Java 5 auto-boxing of numbers uses these methods implicitly, so in many cases we can just remove the calls to the constructor and the compiler will automatically insert the calls for us.
Attachments
Attachments
Issue Links
- is related to
-
DERBY-6391 remove unneeded object creation in newException() calls in releases > 10.10
- Resolved