Felipe Schnack <felipes@ritterdosreis.br> wrote:
> Is... but what got better with JVM 1.4 was synch'ing not object
> creation, so you're basically saying I'm correct? :-)
I think it depends on the virtual machine, but I'm no expert.
I just had a look at the latest StringBuffer sources. What setLength(0)
does, is to wipe the whole buffer with null-bytes ('\0') in a loop! Although
I have no idea why it is done, it seems to be very inefficient. Especially
when you think of the fact, that this single StringBuffer will grow,
everytime a bigger string is put into it. It seams that sb.delete(0,
sb.length); is much more efficient. It just resets the internal length
counter?
Any comments?
Regards,
Michael Paesold