Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8156070 Immutable Collections enhancements
  3. JDK-8156071

reduce varargs array creation and unnecessary copying during creation

    Details

    • Type: Sub-task
    • Status: Open
    • Priority: P4
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: tbd
    • Component/s: core-libs
    • Labels:
      None

      Description

      The various fixed-arg factory methods mostly call internal varargs constructors, causing array creating and element copying. The resulting array is passed to a constructor that creates another array and copies it (or clones it) again. Consider the List.of(...) methods that call the ListN() constructor. This is quite wasteful.

      This area should be re-examined. Solutions might include adding fixed-arg overloads for the internal constructors, and also non-cloning but possibly still null-checking array-consuming constructors.

      See Peter Levart's comments here:

      http://mail.openjdk.java.net/pipermail/core-libs-dev/2016-May/040791.html

        Attachments

          Activity

            People

            • Assignee:
              smarks Stuart Marks
              Reporter:
              smarks Stuart Marks
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated: