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
Views: Raw Message | Whole Thread | Download mbox | Resend email
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

Browse pgsql-jdbc by date

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