> This change mirrors what we did for ConcurrentHashMap in > https://github.com/openjdk/jdk/pull/17116. When we add all entries from one > map to anther, we should resize that map to the size of the sum of both maps. > > I used the command below to run the benchmarks. I set a high heap to reduce > garbage collection noise. > > java -Xms25G -jar benchmarks.jar -p size=100000 -p addSize=100000 -gc true > org.openjdk.bench.java.util.HashMapBench > > > Before change > > > Benchmark (addSize) (mapType) (size) Mode Cnt Score > Error Units > HashMapBench.putAll 100000 HASH_MAP 100000 avgt 4 22.927 ± > 3.170 ms/op > HashMapBench.putAll 100000 LINKED_HASH_MAP 100000 avgt 4 25.198 ± > 2.189 ms/op > > > After change > > > Benchmark (addSize) (mapType) (size) Mode Cnt Score > Error Units > HashMapBench.putAll 100000 HASH_MAP 100000 avgt 4 16.780 ± > 0.526 ms/op > HashMapBench.putAll 100000 LINKED_HASH_MAP 100000 avgt 4 19.721 ± > 0.349 ms/op > > > We see about average time improvements of 26% in HashMap and 20% in > LinkedHashMap.
Joshua Cao has updated the pull request incrementally with one additional commit since the last revision: Add benchmark with all duplicate keys ------------- Changes: - all: https://git.openjdk.org/jdk/pull/17544/files - new: https://git.openjdk.org/jdk/pull/17544/files/d1ad90cd..a74c10da Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=17544&range=01 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=17544&range=00-01 Stats: 14 lines in 1 file changed: 14 ins; 0 del; 0 mod Patch: https://git.openjdk.org/jdk/pull/17544.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/17544/head:pull/17544 PR: https://git.openjdk.org/jdk/pull/17544