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

String.join and StringJoiner can be improved further

    XMLWordPrintable

    Details

    • Type: Enhancement
    • Status: Resolved
    • Priority: P4
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 17
    • Component/s: core-libs
    • Labels:
      None
    • Subcomponent:
    • Introduced In Version:
      15
    • Resolved In Build:
      b20
    • CPU:
      generic
    • OS:
      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

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

                Dates

                Created:
                Updated:
                Resolved: