X-Original-To: pgsql-jdbc-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 2C4E58B9B39 for ; Tue, 22 Feb 2005 10:20:03 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 97190-06 for ; Tue, 22 Feb 2005 10:19:51 +0000 (GMT) Received: from mail25.sea5.speakeasy.net (mail25.sea5.speakeasy.net [69.17.117.27]) by svr1.postgresql.org (Postfix) with ESMTP id F2BB78B9E62 for ; Tue, 22 Feb 2005 10:19:46 +0000 (GMT) Received: (qmail 4252 invoked from network); 22 Feb 2005 10:19:45 -0000 Received: from dsl093-130-165.sfo4.dsl.speakeasy.net (HELO [192.168.0.42]) (kgeis@[66.93.130.165]) (envelope-sender ) by mail25.sea5.speakeasy.net (qmail-ldap-1.03) with AES256-SHA encrypted SMTP for ; 22 Feb 2005 10:19:45 -0000 Message-ID: <421B0740.3050104@speakeasy.net> Date: Tue, 22 Feb 2005 02:19:44 -0800 From: Ken Geis User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.3) Gecko/20040910 X-Accept-Language: en-us, en MIME-Version: 1.0 To: pgsql-jdbc@postgresql.org Subject: Performance tweaks Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= X-Spam-Level: X-Archive-Number: 200502/151 X-Sequence-Number: 12331 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