Re: Minor performance improvements - Mailing list pgsql-jdbc

From Kris Jurka
Subject Re: Minor performance improvements
Date
Msg-id Pine.BSO.4.64.0702280104180.7285@leary.csoft.net
Whole thread Raw
In response to Re: Minor performance improvements  ("Stephen Denne" <Stephen.Denne@datamail.co.nz>)
List pgsql-jdbc

On Tue, 27 Feb 2007, Stephen Denne wrote:

> I had a different implementation in mind for Send(byte buf[], int off,
> int siz) along the lines of:
>

I'm not convinced this will be significantly faster, but it is slightly
clearer, so I've incorporated it.

> Is there a reason for removing pg_input.ensureBytes(siz)? I see you're
> checking the length of what was read instead. Is this always equivalent
> or sufficient? Does it block in diferent ways?

Internally VisibleBufferedInputStream will end up calling ensureBytes in
the read call.  I don't think the actual read length check is necessary,
but it's the sort of thing that could easily break if we changed the
VisbibleBufferedInputStream implementation.

> When converting ints to bytes, you do not need to mask with 255 (see
> int0 to int3 in java.nio.Bits).

Yes, removed.

> Is it possible other people have code that is calling
> ReceiveIntegerR(int siz)?
>

No, PGStream is an internal only class.

Kris Jurka

pgsql-jdbc by date:

Previous
From: Kris Jurka
Date:
Subject: Re: postgresql 7.4 driver for java 5
Next
From: Kris Jurka
Date:
Subject: Re: Minor performance improvements