Uploaded image for project: 'Xerces2-J'
  1. Xerces2-J
  2. XERCESJ-1107

[PATCH] Cleanup inefficient StringBuffer code

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 2.7.1
    • 2.8.0
    • None
    • None

    Description

      StringBuffers are used through the code, but in a way that reduces their performance below, perhaps, what normal String concatenation would be.

      Doing

      StringBuffer s = new StringBuffer();
      s.append(a + b);

      is the same as

      StringBuffer s = new StringBuffer();
      s.append(new StringBuffer(a).append(b).toString());

      So, don't do normal concatentation in an append call, since one went to the trouble to use StringBuffer's in the first place.

      Attachments

        1. sb_cleanup.diff
          12 kB
          David Brosius

        Activity

          People

            mrglavas@ca.ibm.com Michael Glavassevich
            dbrosius David Brosius
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: