pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Ken Geis <kgeis@speakeasy.net>
To: pgsql-jdbc@postgresql.org
Subject: Performance tweaks
Date: Tue, 22 Feb 2005 02:19:44 -0800
Message-ID: <421B0740.3050104@speakeasy.net> (raw)

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




view thread (9+ messages)  latest in thread

Message-ID: <421B0740.3050104@speakeasy.net>
Permalink:  ../421B0740.3050104@speakeasy.net/
Also on:    postgresql.org/message-id/421B0740.3050104@speakeasy.net

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-jdbc@postgresql.org
  Cc: kgeis@speakeasy.net
  Subject: Re: Performance tweaks
  In-Reply-To: <421B0740.3050104@speakeasy.net>
  References: <421B0740.3050104@speakeasy.net>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox