RFR JDK-8011200 (was 7143928) : (coll) Optimize for Empty ArrayList and HashMap

Mike Duigou mike.duigou at oracle.com
Wed Apr 10 00:19:45 UTC 2013


On Apr 8 2013, at 05:52 , Alan Bateman wrote:

> I think this is the webrev:
> 
> http://cr.openjdk.java.net/~mduigou/JDK-8011200/2/webrev/
> 
> It's impossible to predict what the usage will be after you reconstitute.

I agree completely. We should have a consistent policy for both deserialization and clone(). 

> Personally I think it's better to leave it as is, meaning the rounded-up size as otherwise you might reconstitute to a capacity that is much more than you might ever need.

This is my feeling as well. I especially wonder about the extra space of clone()ed maps. Seems like a good opportunity for savings.

> 
> I didn't notice in the previous revisions but roundUpToPowerOf2 can assign "rounded" twice (it probably doesn't happen when it gets compiled at runtime but still looks a bit odd).

All in the name of optimization. 

> 
> The test still have the bug issue number.

Sorry for not correcting this in earlier revs.

> -Alan
> 




More information about the core-libs-dev mailing list