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

(str) optimize StringBuilder.append(CharSequence, start, end)

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Unresolved
    • Icon: P3 P3
    • tbd
    • None
    • core-libs
    • None

      If you have a StringBuilder sb and a String str, then the following method runs very quickly:

          sb.append(str)

      because this method is an intrinsic. However, if you want to append only a subrange of the source string,

          sb.append(str, start, end)

      is much slower, because it does some range checking and then runs a Java loop from AbstractStringBuilder to do the copying.

      It might be a useful optimization to optimize this code path, possibly by providing an intrinsic for StringBuilder.append(String, start, end).

            Unassigned Unassigned
            smarks Stuart Marks
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: