EVALUATION
One of the changes for the BigInteger improvement is to remove the implicit initialization for a few of fields such as "bitCount", "bitLength" & "lowestSetBit". The removal of initialization for "lowestSetBit" will affect the largest BigInteger values people working with theoretically. Generally speaking, BigInteger wasn't designed to handle such case, but standing on the cautious side is always good, so I am going to file a CCC request to cover that.
|
EVALUATION
I have a webrev at http://javaweb.sfbay/~xl116366/webrev/bigdecimal_opt for review. To ease future reference, here are some highlights for the changes which affect the performance significantly.
1. Make TENPOWERS array to be expandable so that we don't have to construct BigInteger of ten's power repeatedly. The default maximum size of the array is 304 which means it can hold up to 10**303.
2. Make digitLength to work efficiently by avoiding division operation which is generally considered as expensive. Use the TENPOWERS array which is now expandable, we can now apply the same trick for computing the integer length to these big integers.
3. Clean up MathContext to avoid creating unnecessary BigInteger objects, drop "dropDigits".
4. Have a trusted version of divide method to avoid repeatedly roundingMode checks.
|