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

Use Escape Analysis to optimize StringBuffer.toString()

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Duplicate
    • Icon: P3 P3
    • 7
    • 7
    • hotspot
    • None
    • generic
    • generic

      A common use of StringBuffer in Java programs is that a local StringBuffer
      object is used to build a character sequences which is then converted to a
      String. This conversion involves allocating a new char array and copying
      the StringBuffer's char array.

      If both the StringBuffer and String do not escape, this operation can be
      optimized: the char array from the StringBuffer can be used directly for
      the String in some cases. This is possible if the compiler can determine
      that the char array is never modified after the String creation.

            kvn Vladimir Kozlov
            sdeversunw Steve Dever (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: