Re: Minor performance improvements - Mailing list pgsql-jdbc

From Stephen Denne
Subject Re: Minor performance improvements
Date
Msg-id F0238EBA67824444BC1CB4700960CB485750FF@dmpeints002.isotach.com
Whole thread Raw
In response to Re: Minor performance improvements  ("Stephen Denne" <Stephen.Denne@datamail.co.nz>)
Responses Re: Minor performance improvements  (Kris Jurka <books@ejurka.com>)
List pgsql-jdbc

Sorry for the formatting of this message....

I tested using a ByteBuffer wrapped as an IntBuffer... quite good, but not the fastest.

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

int i = buf.length - off;

if (i < siz) {

pg_output.write(buf, off, i);

for (; i < siz; ++i) {

pg_output.write(0);

}

} else {

pg_output.write(buf, off, siz);

}

 
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?
 
When converting ints to bytes, you do not need to mask with 255 (see int0 to int3 in java.nio.Bits).
 
Is it possible other people have code that is calling ReceiveIntegerR(int siz)?
 
Stephen Denne.


From: Kris Jurka [mailto:books@ejurka.com]
Sent: Tue 27/02/2007 9:21 p.m.
To: Stephen Denne
Cc: pgsql-jdbc@postgresql.org
Subject: Re: [JDBC] Minor performance improvements



On Mon, 26 Feb 2007, Kris Jurka wrote:

> I've created the attached test which tests the original code (Orig), your
> code (Two), and my suggestion of an int4buf (Three) and got the following
> surprising results:
>

Based on that test and a similar attached test for reading, I'm prepared
to apply the attached patch.  Let me know what you think.

Kris Jurka




At the Datamail Group we value team commitment, respect, achievement, customer focus, and courage.

This email with any attachments is confidential and may be subject to legal privilege. If it is not intended for you please advise by reply immediately, destroy it and do not copy, disclose or use it in any way.





This email has been scanned by the DMZGlobal Business Quality Electronic Messaging Suite.
Please see http://www.dmzglobal.com/services/bqem.htm for details.



pgsql-jdbc by date:

Previous
From: Nelson Arape
Date:
Subject: Re: Minor performance improvements
Next
From: Nelson Arape
Date:
Subject: Re: Minor performance improvements