RFR: : (coll) IdentityHashMap is resized before exceeding the expected maximum size
peter.levart at gmail.com
Sat Jul 12 19:20:06 UTC 2014
On 07/12/2014 08:12 PM, Peter Levart wrote:
> (3 * size < 2 * highestOneBit(3*size)) is true for any size, so IHM
> will never be resized if filled with size elements and table was
> preallocated with length =
> 2 * highestOneBit(3*size) even if condition for resizing is changed
> from (3*size > length) to (3*size >= length). Current condition
> sometimes resizes a little to late when preallocation would already
> create a bigger table.
May latest statement is of course false. If length is a power of two,
then it can never be equal 3*size. For power of two lengths, both
conditions are equivalent. But for my purpose the >= is better...
More information about the core-libs-dev