Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-2126717 | 5.0u5 | Joe Darcy | P4 | Resolved | Fixed | b02 |
A DESCRIPTION OF THE REQUEST :
BigDecimal.doubleValue(), BigDecimal.floatValue(), BigInteger.doubleValue(), and BigInteger.floatValue() all create unneeded objects to return their results. For example, BigDecimal.doubleValue() could be changed from:
return Double.valueOf(this.toString()).doubleValue();
to
return Double.parseDouble(this.toString());
This avoids creating new Double objects just to call their doubleValue() methods
to get the primitive value.
The implemenation of Double.parseDouble() and Double.valueOf() are nearly identical because they both ultimately call FloatingDecimal.readJavaFormatString(). So, this change should not change the methods' behavior.
JUSTIFICATION :
This change is an easy way to get improved performance out of these methods by not creating and destroying unneeded objects.
###@###.### 2005-05-23 11:08:59 GMT
BigDecimal.doubleValue(), BigDecimal.floatValue(), BigInteger.doubleValue(), and BigInteger.floatValue() all create unneeded objects to return their results. For example, BigDecimal.doubleValue() could be changed from:
return Double.valueOf(this.toString()).doubleValue();
to
return Double.parseDouble(this.toString());
This avoids creating new Double objects just to call their doubleValue() methods
to get the primitive value.
The implemenation of Double.parseDouble() and Double.valueOf() are nearly identical because they both ultimately call FloatingDecimal.readJavaFormatString(). So, this change should not change the methods' behavior.
JUSTIFICATION :
This change is an easy way to get improved performance out of these methods by not creating and destroying unneeded objects.
###@###.### 2005-05-23 11:08:59 GMT
- backported by
-
JDK-2126717 BigDecimal.doubleValue() performance improvement
-
- Resolved
-