Welcome Guest!
 Internet Alchemy
 Previous Message All Messages Next Message 
The StringBuffer Myth  Arno Huetter
 Jan 16, 2003 11:03 PST 
The StringBuffer Myth - Reopened

What causes the big performance penalty difference of String concatenation
in comparison to StringBuffer is not the number of calls to
StringBuffer.append(), but the StringBuffer's capacity. If the capacity is
exceeded by append(), the internal buffer needs to be re-allocated. The
capacity can be changed programmatically, by passing the expected length (or
somewhat more) to the StringBuffer constructor. The default StringBuffer
constructor (as employed when concatenating Strings with +) defines a
capacity of 16 - too few in most of the cases.

Kind regards,
Arno Huetter
	
 Previous Message All Messages Next Message 
  Check It Out!

  Topica Channels
 Best of Topica
 Art & Design
 Books, Movies & TV
 Developers
 Food & Drink
 Health & Fitness
 Internet
 Music
 News & Information
 Personal Finance
 Personal Technology
 Small Business
 Software
 Sports
 Travel & Leisure
 Women & Family

  Start Your Own List!
Email lists are great for debating issues or publishing your views.
Start a List Today!

© 2001 Topica Inc. TFMB
Concerned about privacy? Topica is TrustE certified.
See our Privacy Policy.