hollow
hollow copied to clipboard
ByteArrayOrdinalMap growth appears to be too aggressive
I think ByteArrayOrdinalMap
grows too aggressively:

Wouldn't 134217728
be the table size with a load factor of 1.0? (I haven't taken the time to look really closely at the implementation, but I'm assuming pointersAndOrdinals
is just the key array).
One explanation for the discrepancy of sizeBeforeGrow
and pointersAndOrdinals.length()
is those fields are not marked as volatile
and not all methods of the class are synchronized. I don't see how the discrepancy could occur otherwise given the following code is the only place where the fields are updated (in growKeyArray
):
/// 70% load factor
sizeBeforeGrow = (int) (((float) newKeys.length()) * 0.7);
pointersAndOrdinals = newKeys;
See also #378