logo       
Google Custom Search
    AddThis Social Bookmark Button
-->

[jira] Created: (XERCESJ-1107) [PATCH] Cleanup inefficient StringBuffer cod: msg#00033

Subject: [jira] Created: (XERCESJ-1107) [PATCH] Cleanup inefficient StringBuffer code
[PATCH] Cleanup inefficient StringBuffer code
---------------------------------------------

         Key: XERCESJ-1107
         URL: http://issues.apache.org/jira/browse/XERCESJ-1107
     Project: Xerces2-J
        Type: Improvement
    Versions: 2.7.1    
    Reporter: Dave Brosius
    Priority: Minor


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.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


<Prev in Thread] Current Thread [Next in Thread>