Re: synchronized code - Mailing list pgsql-jdbc

From Michael Paesold
Subject Re: synchronized code
Date
Msg-id 01be01c2b752$d10e45d0$3201a8c0@beeblebrox
Whole thread Raw
In response to synchronized code  (Felipe Schnack <felipes@ritterdosreis.br>)
Responses Re: synchronized code
List pgsql-jdbc
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


pgsql-jdbc by date:

Previous
From: Joseph Shraibman
Date:
Subject: Re: ArrayIndexOutOfBoundsException in Encoding.decodeUTF8()
Next
From: Joseph Shraibman
Date:
Subject: Re: ArrayIndexOutOfBoundsException in Encoding.decodeUTF8()