United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
Bug ID: JDK-4261803 Need an unsynchronized StringBuffer
JDK-4261803 : Need an unsynchronized StringBuffer

Details
Type:
Enhancement
Submit Date:
1999-08-11
Status:
Resolved
Updated Date:
2003-08-01
Project Name:
JDK
Resolved Date:
2003-08-01
Component:
core-libs
OS:
generic,windows_2000
Sub-Component:
java.lang
CPU:
x86,generic
Priority:
P3
Resolution:
Fixed
Affected Versions:
1.2.2,1.3.0,1.3.1,1.4.0,1.4.2
Fixed Versions:
5.0 (tiger)

Related Reports
Duplicate:
Duplicate:
Duplicate:
Relates:
Relates:
Relates:
Relates:

Sub Tasks

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
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
                                     
2002-10-18
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.
======================================================================
                                     
2004-06-11
CONVERTED DATA

BugTraq+ Release Management Values

COMMIT TO FIX:
tiger

FIXED IN:
tiger

INTEGRATED IN:
tiger
tiger-b14


                                     
2004-06-14



Hardware and Software, Engineered to Work Together