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

String.join and StringJoiner can be improved further

    XMLWordPrintable

Details

    • Enhancement
    • Resolution: Fixed
    • P4
    • 17
    • None
    • core-libs
    • None
    • 15
    • b20
    • generic
    • generic

    Description

      While JDK-8148937 improved StringJoiner class by replacing internal use of getChars that copies out characters from String elements into a char[] array with StringBuilder which is somehow more optimal, the improvement was marginal in speed (0% ... 10%) and mainly for smaller strings, while GC was reduced by about 50% in average per operation.
      Initial attempt in that issue was more involved, but was later discarded because it was apparently using too much internal String details in code that lives outside String and outside java.lang package.
      But there is another way to package such "intimate" code - we can put it into String itself and just call it from StringJoiner. This issue is an attempt at doing just that.

      Attachments

        Issue Links

          Activity

            People

              plevart Peter Levart
              plevart Peter Levart
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: