Re: Minor performance improvements

From: "Stephen Denne" <Stephen(dot)Denne(at)datamail(dot)co(dot)nz>
To: "Kris Jurka" <books(at)ejurka(dot)com>
Cc: <pgsql-jdbc(at)postgresql(dot)org>
Subject: Re: Minor performance improvements
Date: 2007-02-27 10:46:33
Message-ID: F0238EBA67824444BC1CB4700960CB485750FF@dmpeints002.isotach.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)ejurka(dot)com]
Sent: Tue 27/02/2007 9:21 p.m.
To: Stephen Denne
Cc: pgsql-jdbc(at)postgresql(dot)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

</PRE><div style="font-size:8pt;font-family:Tahoma,Arial; text-align:justify; color:gray;"><br><br><hr size="0">At the Datamail Group we value team commitment, respect, achievement, customer focus, and courage.<br><br>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.<hr size="0"><br><br></div>
</PRE><div style="font-size:8pt;font-family:Arial; text-align:center;"><br><br><hr size="0">
This email has been scanned by the DMZGlobal Business Quality Electronic Messaging Suite.<br>
Please see <a href="http://www.dmzglobal.com/services/bqem.htm">http://www.dmzglobal.com/services/bqem.htm</a> for details.<br>
<hr size="0"><br><br></div>

In response to

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Mario Splivalo 2007-02-27 12:24:18 Re: Calling functions with table-based-type parametars
Previous Message Kris Jurka 2007-02-27 08:21:25 Re: Minor performance improvements