RFR: 8316493: Make immutable maps @ValueBased

Per Minborg pminborg at openjdk.org
Tue Sep 19 07:10:06 UTC 2023


This PR outlines a solution for making immutable maps `@ValueBased` by removing cacheing of certain values in `AbstractMap`.

By removing these caching fields in `AbstractMap`, we can make the immutable maps `@ValueBased` and at the same time, performance is likely improved because the JVM is probably able to optimize away object creation anyway via escape analysis. Also, all maps will occupy less space as we get rid of a number of objects and references stored for each map.

We need to benchmark this solution to better understand its implications.

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

Commit messages:
 - Merge pull request #4 from cl4es/HashMapViews
 - Add simple HashMapViews microbenchmark
 - Remove caching in AbstractMap and make immutable maps @ValueBased

Changes: https://git.openjdk.org/jdk/pull/15614/files
 Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=15614&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8316493
  Stats: 276 lines in 9 files changed: 92 ins; 107 del; 77 mod
  Patch: https://git.openjdk.org/jdk/pull/15614.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/15614/head:pull/15614

PR: https://git.openjdk.org/jdk/pull/15614


More information about the core-libs-dev mailing list