RFR: 8281631: HashMap copy constructor and putAll can over-allocate table [v34]

XenoAmess duke at openjdk.java.net
Thu Mar 17 03:30:57 UTC 2022


On Thu, 17 Mar 2022 03:09:53 GMT, Stuart Marks <smarks at openjdk.org> wrote:

> There's already a bug for this: [JDK-8186958](https://bugs.openjdk.java.net/browse/JDK-8186958). This includes creating a new API as well as fixing up a bunch of call sites. There's a partial list of call sites in java.base there. Go ahead and open a PR if you like.

got it.

>  I'd avoid updating all the individual call sites with the actual computation `(int) (Math.ceil(expectedSize/0.75))` because we might want to change it in the future.

Yes, I still prefer my int calculation way...

But I guess a jmh for several implementations is necessary.

-------------

PR: https://git.openjdk.java.net/jdk/pull/7431


More information about the core-libs-dev mailing list