Chris, The overhead of uncontested synchronization is very small and in some cases is completely eliminated by the JITc. Before you worry about switching to an unsynchronized StringBuffer you should profile your code to make sure that doing so will actually help - when the StringBuffer is a local variable that's not passed to other methods, it almost certainly won't help.
In some cases and on some JVMs it may make a difference though, only profiling can tell. Not that I'm against the idea... Regards, Adrian Sutton, Software Engineer Ephox Corporation www.ephox.com -----Original Message----- From: Chris Feldhacker [mailto:[EMAIL PROTECTED] Sent: Thursday, 7 August 2003 1:30 PM To: Jakarta Commons Developers List Subject: [lang] FastStringBuffer? Maybe I'm missing something, or maybe this has been discussed before, but... Is there a replacement for StringBuffer someplace, perhaps a "FastStringBuffer" class? I only ask because StringBuffers are used everywhere, even internally by the 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 threads to access the same StringBuffer. So, why not eliminate the synchronized method calls and increase performance? --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]