Maybe this helps on this topic:
http://wiki.java.net/bin/view/Javapedia/AlwaysUseStringBufferMisconception#Concatenating_Literal_Strings

Stefano

Danny Angus wrote:
On 11/14/06, Bernd Fondermann <[EMAIL PROTECTED]> wrote:
On 11/14/06, Joachim Draeger <[EMAIL PROTECTED]> wrote:

Memory garbage should not be a problem any longer in the light of
generational GCs.

I'm not sure how you arrive at this sweeping conclusion!
Profligate use of memory is a problem no matter what CG algorythm you
use because even if the collector is capable of collecting it uses
clock cycles to do it. This is a cost. If your application is reaching
the bounds of its resources, because it is under heavy load, then
unecessary use of cpu or memory will be a factor in the limits of
performance which you can reach.

A large number of string concatenations will always result in a lot of
allocations, even if it is optimised to use StringBuffer, unless you
are using StringBuffer directly you will have a string (or byte[] or
whatever) as input for each component part, a string buffer which is
larger than the output and an output string. Thus you use 200% more
memory than not doing it at all.

d.



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to