On Sun, 20 Feb 2022 18:03:07 GMT, XenoAmess <d...@openjdk.java.net> wrote:
>> XenoAmess has updated the pull request incrementally with three additional >> commits since the last revision: >> >> - refine test >> - 1. optimize IdentityHashMap that when calling ::new(Map), do not call >> map.size() twice but once. >> 2. delete the this((int) ((1 + m.size()) * 1.1)); as it makes the table >> over-allocate when size = 19. >> - refine test > > src/java.base/share/classes/java/util/IdentityHashMap.java line 270: > >> 268: */ >> 269: public IdentityHashMap(Map<? extends K, ? extends V> m) { >> 270: this(m, m.size()); > > I actually do not know if this change shall be in this pr, or in a new issue. > But the original codes can cause IdentityHashMap to over-allocate at size == > 19. > @stuart-marks what do you think about this? I checked this `(int) ((1 + m.size()) * 1.1)`. It is there when the codes original created there at 2007. I don't thik it reasonable. or is there eveidence it be? ------------- PR: https://git.openjdk.java.net/jdk/pull/7431