Re: synchronized code

From: "Michael Paesold" <mpaesold(at)gmx(dot)at>
To: "Felipe Schnack" <felipes(at)ritterdosreis(dot)br>, "pgsql-jdbc" <pgsql-jdbc(at)postgresql(dot)org>
Subject: Re: synchronized code
Date: 2003-01-08 20:16:23
Message-ID: 01be01c2b752$d10e45d0$3201a8c0@beeblebrox
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

Felipe Schnack <felipes(at)ritterdosreis(dot)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

In response to

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Joseph Shraibman 2003-01-08 20:48:23 Re: ArrayIndexOutOfBoundsException in Encoding.decodeUTF8()
Previous Message Joseph Shraibman 2003-01-08 19:51:38 Re: ArrayIndexOutOfBoundsException in Encoding.decodeUTF8()