Possible HashSet memory improvement
Remi Forax
forax at univ-mlv.fr
Sun Oct 6 18:18:13 UTC 2013
On 10/06/2013 08:09 PM, Philippe Marschall wrote:
>
>
> On 05.10.2013 21:57, Brian Goetz wrote:
>>> Is there something I missed? Is this something that has been
>>> considered?
>>
>> If memory efficiency were the only metric in the world, this would be
>> a no-brainer. But, by having different classes for different nodes,
>> many many paths where the VM could prove monomorphism and thereby
>> inline through now become polymorphic and at best could be inline
>> cached.
>>
>> ...
>>
>
> Doesn't the rb-tree collision handling in HashMap already introduce
> different classes for different nodes (Node and TreeNode)? Or is the
> assumption there that this doesn't happen in production and therefore
> does not introduce polymorphism?
The actual code carefully introduces polymorphism only if there is an
abnormal number of collisions,
either because a method hashCode() is badly written or someone tries to
DDOS the HashMap.
>
> Cheers
> Philippe
cheers,
Rémi
More information about the core-libs-dev
mailing list