Performance tweaks - Mailing list pgsql-jdbc

From Ken Geis
Subject Performance tweaks
Date
Msg-id 421B0740.3050104@speakeasy.net
Whole thread Raw
Responses Re: Performance tweaks
Re: Performance tweaks
Re: Performance tweaks
List pgsql-jdbc
I'm running some tests with PostgreSQL 8.0, JDK 1.5.0, and the CVS head
JDBC driver to see if I can squeeze some performance out of it.

I'm using an old JDBCBench program
(http://developer.mimer.com/features/feature_16.htm) as a test harness.
  It seems this program's major goal is to measure the server's response
to a load, but the JDBC driver will play some part in the measurement.

I was able to get over 5% increase on my setup with a few small changes.

First, in PGStream, I "unrolled" SendInteger4 and SendInteger2, like this:

     private static final byte[] B4 = new byte[4];
     public void SendInteger4(int val) throws IOException
     {
         B4[0] = (byte) ((val >> 24)&255);
         B4[1] = (byte) ((val >> 16)&255);
         B4[2] = (byte) ((val >> 8)&255);
         B4[3] = (byte) (val&255);
         pg_output.write(B4, 0, 4);
     }

Between the two of these, I got a ~4% increase.  The code is slightly
uglier, but it might be worth some performance.  The sneakier (and less
likely to be controversial) one was also in PGStream.  I changed the line

         byte[][] answer = new byte[l_nf][0];
to
         byte[][] answer = new byte[l_nf][];

This gave ~1% increase on the benchmark I was running.


I'll keep you posted if I find anything else to improve.  On your to-do
list, I am really looking forward to the "Allow binary data transfers
for all datatypes not just bytea."


Ken Geis


pgsql-jdbc by date:

Previous
From: "Nico"
Date:
Subject: Re: making a rule and know when it is violated
Next
From: Vadim Nasardinov
Date:
Subject: stack traces are evil (was: Re: Crystal Reports / PostgreSQL)