commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Brian S O'Neill" <>
Subject Re: [lang] FastStringBuffer?
Date Thu, 07 Aug 2003 14:02:18 GMT
The big advantage that the StringBuffer has is that it's defined in the
java.lang package. As a result, it has access to package private members of
the String class. Calling toString on StringBuffer does not allocate a copy
of the characters, but rather passes the reference to it's char[]. With any
FastStringBuffer class, a copy will be created. This will likely hurt
performance much more than removing synchronization.

----- Original Message ----- 
From: "Chris Feldhacker" <>
To: "Jakarta Commons Developers List" <>
Sent: Wednesday, August 06, 2003 08:30 P
Subject: [lang] FastStringBuffer?

> Maybe I'm missing something, or maybe this has been discussed before,
> Is there a replacement for StringBuffer someplace, perhaps a
> "FastStringBuffer" class?
> I only ask because StringBuffers are used everywhere, even internally by
> JVM.  However, all of the methods on the StringBuffer class are
> synchronized.  In my experience (and in looking through most of the lang
> code), 99% of the time StringBuffer is only used as a method variable to
> compose a message String; therefore, it is not possible for multiple
> to access the same StringBuffer.  So, why not eliminate the synchronized
> method calls and increase performance?
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

View raw message