Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8316493

Remove the caching fields in AbstractMap

    XMLWordPrintable

Details

    • Enhancement
    • Resolution: Unresolved
    • P3
    • 24
    • 22
    • core-libs
    • None

    Description

      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.

      Attachments

        Issue Links

          Activity

            People

              pminborg Per-Ake Minborg
              pminborg Per-Ake Minborg
              Votes:
              1 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated: