-
Enhancement
-
Resolution: Unresolved
-
P3
-
22
-
None
The immutable maps that are available via the static factories `Map::of` cannot return `@ValueBased` maps because `AbstractMap` declares fields.
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.
In addition, several Map implementations have their own copies of the cached fields (even though they inherit from AbstractMap) and cache views in the same way. These should be removed as well.
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.
In addition, several Map implementations have their own copies of the cached fields (even though they inherit from AbstractMap) and cache views in the same way. These should be removed as well.
- csr for
-
JDK-8316583 Remove the caching fields in AbstractMap
- Provisional
- relates to
-
JDK-8145539 (coll) AbstractMap.keySet and .values should not be volatile
- Resolved
- links to
-
Review(master) openjdk/jdk/15614