This is the mail archive of the
java@gcc.gnu.org
mailing list for the Java project.
Non-synchronized StringBuffer
- From: Tom Tromey <tromey at redhat dot com>
- To: Java Discuss List <java at gcc dot gnu dot org>
- Date: 23 Nov 2001 20:39:04 -0700
- Subject: Non-synchronized StringBuffer
- Reply-to: tromey at redhat dot com
Tonight I hacked up something we've discussed here before: I changed
gcj so that `+' of Strings uses a gcj-specific unsynchronized copy of
StringBuffer.
I was surprised to discover that in my simple test (several thousand
String `+' operations), removing synchronization made the code slower.
I have no explanation for this. In fact, if somebody else has an
explanation I'd love to hear it.
I didn't try stack-allocating the StringBuffer object itself. This is
possible, but it was more work than I was willing to do tonight.
If anybody is interested in this I can send the patch I've got.
Tom