X-Original-To: pgsql-jdbc-postgresql.org@postgresql.org Received: from localhost (wm.hub.org [200.46.204.128]) by postgresql.org (Postfix) with ESMTP id DBFA79FB20C for ; Wed, 23 Aug 2006 11:36:33 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.128]) (amavisd-new, port 10024) with ESMTP id 56485-02 for ; Wed, 23 Aug 2006 14:36:18 +0000 (UTC) X-Greylist: delayed 00:05:00.905869 by SQLgrey- Received: from jcour.kyon.de (www.ky-on.de [213.9.98.91]) by postgresql.org (Postfix) with ESMTP id B32FE9FB1F2 for ; Wed, 23 Aug 2006 11:36:16 -0300 (ADT) Received: from [10.0.4.2] (gw-cust1497.hkn.net [213.9.96.234]) (AUTH: LOGIN tt, SSL: TLSv1/SSLv3,256bits,AES256-SHA) by jcour.kyon.de with esmtp; Wed, 23 Aug 2006 16:31:13 +0200 id 00072F7F.44EC66B1.00000820 Message-ID: <44EC66B0.2040108@kyon.de> Date: Wed, 23 Aug 2006 16:31:12 +0200 From: till toenges User-Agent: Thunderbird 1.5.0.5 (Macintosh/20060719) MIME-Version: 1.0 To: Luis Vilar Flores CC: pgsql-jdbc@postgresql.org Subject: Re: bytea memory improvement References: <44EB8C82.1000203@evolute.pt> In-Reply-To: <44EB8C82.1000203@evolute.pt> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=3.951 tagged_above=0 required=5 tests=FORGED_RCVD_HELO, SPF_HELO_SOFTFAIL, SPF_SOFTFAIL X-Spam-Level: *** X-Archive-Number: 200608/106 X-Sequence-Number: 15633 Luis Vilar Flores wrote: > Hope to hear some feedback soon, hope I didn't forget anything ... I have an idea for a minor improvement. The MAX_3_BUFF_SIZE is set to 0. Actually, you can immediately return an empty byte array if the size of the incomming buffer is 0; that could be a static final byte[], because nobody could do anything with it anyway. In all other cases, the 2 buffer method is simpler and faster, because it uses fewer buffers and memory accesses, and is therefore the right solution. Till