review request for 6622432
Xiaobin.Lu at Sun.COM
Tue Feb 17 18:29:43 UTC 2009
On 02/17/09 03:15, Christian Thalinger wrote:
> On Mon, 2009-02-16 at 14:33 -0800, Xiaobin Lu wrote:
>> Webrev: http://webrev.invokedynamic.info/xiaobin.lu/6622432/
>> 6622432: RFE: Performance improvements to java.math.BigDecimal
>> As you know, the division operation is expensive and the
>> algorithm to compare with the ten's power array can be made more
>> efficiently by correlating the bit length of the number with the index
>> to the array so that the time to compute the precision is O(1) rather
>> than being O(n) (where n is the length of the array). And that is
>> exactly what we are doing in the webrev. First, we get the bit length of
>> the number and then multiply it with log2 (10 base), use the result to
>> index to a dynamically expanded ten's power array so that division
>> operation can be avoided completely.
> Actually I'm not reviewing the webrev but I have some questions.
> 1. Is bitCount() called often and performance critical? There is a RFE
> (6378821) to intrinsify it and I am thinking about to implement it.
No, I don't think it is a hot method in both derby and SPECjbb2005 based
on the profiling information from Analyzer. I might be wrong, but you
can verify it easily.
> 2. Why is BigInteger using it's own implementation of bit-count
> (bitCnt()) instead of using Integer.bitCount()?
That is a good catch. I will fix it.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the core-libs-dev