JDK-4261803 : Need an unsynchronized StringBuffer
  • Type: Enhancement
  • Component: core-libs
  • Sub-Component: java.lang
  • Affected Version: 1.2.2,1.3.0,1.3.1,1.4.0,1.4.2
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • OS: generic,windows_2000
  • CPU: generic,x86
  • Submitted: 1999-08-11
  • Updated: 2017-05-16
  • Resolved: 2003-08-01
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other
5.0 tigerFixed
Related Reports
Duplicate :  
Duplicate :  
Duplicate :  
Relates :  
Relates :  
Relates :  
Relates :  
Description

Name: krT82822			Date: 08/11/99


(see also 4092829 --kevin.ryan@eng, 8/11/99)

Every modification to StringBuffer is synchronized, to make it
thread safe.  If a large string is being built from many small
pieces, this can be a significant CPU drain.  I have yet to
encounter a situation where I am modifying a StringBuffer from
multiple threads, so I would very much like a class just like
StringBuffer that didn't synchronize.

It would be nice if such a class was included in the java.lang
package.
(Review ID: 93768) 
======================================================================

Comments
CONVERTED DATA BugTraq+ Release Management Values COMMIT TO FIX: tiger FIXED IN: tiger INTEGRATED IN: tiger tiger-b14
14-06-2004

WORK AROUND Name: krT82822 Date: 08/11/99 An application programmer can write a class similar to StringBuffer that isn't synchronized, but it can't be integrated with the String class the way that StringBuffer is. In particular, once the buffer contains a character array that should be turned into a String, a constructor must be called that will create a new character array and copy all the characters rather than using the existing character array. ======================================================================
11-06-2004

EVALUATION Could be done but it requires changing the way that Strings and StringBuffers handle their underlying array hand-off. ###@###.### 2002-03-12 Such a class could significantly improve the performance of Java code that concatenates strings, which is a very frequent operation. See the Comments for details. Such a core class could be used directly by the compiler to handle generation of code for the string concatenation operator. This is a fairly easy way to get significant performance improvements in the platform without any changes to user source code. Our working name for this feature is java.lang.UnsynchronizedStringBuffer. I'm adding this as a Tiger feature. ###@###.### 2002-10-18 With the removal of String/StringBuffer sharing in Tiger, this should be possible. ###@###.### 2003-02-14
18-10-2002