Skip site navigation (1) Skip section navigation (2)

Performance tweaks

From: Ken Geis <kgeis(at)speakeasy(dot)net>
To: pgsql-jdbc(at)postgresql(dot)org
Subject: Performance tweaks
Date: 2005-02-22 10:19:44
Message-ID: 421B0740.3050104@speakeasy.net (view raw or flat)
Thread:
Lists: 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


Responses

pgsql-jdbc by date

Next:From: NicoDate: 2005-02-22 11:06:17
Subject: Re: making a rule and know when it is violated
Previous:From: Sharon AbuDate: 2005-02-22 10:10:59
Subject: PostgreSQL with Oracle OC4J Application server

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group