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 E68E73A3FDF for ; Tue, 2 Nov 2004 19:44:15 +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 66797-08 for ; Tue, 2 Nov 2004 19:44:06 +0000 (GMT) Received: from yass.opencloud.co.nz (yass.opencloud.co.nz [203.79.85.162]) by svr1.postgresql.org (Postfix) with ESMTP id 1E9673A3FCC for ; Tue, 2 Nov 2004 19:44:05 +0000 (GMT) Received: from 203-79-104-60.cable.paradise.net.nz ([203.79.104.60] helo=[192.168.0.20]) by yass.opencloud.co.nz with asmtp (Exim 3.35 #1 (Debian)) id 1CP4ZV-0008Ev-00; Wed, 03 Nov 2004 08:44:01 +1300 Message-ID: <4187E3E7.9080507@opencloud.com> Date: Wed, 03 Nov 2004 08:45:43 +1300 From: Oliver Jowett User-Agent: Mozilla Thunderbird 0.8 (X11/20041021) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Sebastiaan van Erk Cc: pgsql-jdbc@postgresql.org Subject: Re: ps.setCharacterStream() and memory usage References: <20041029115651.GE4199@sebster.com> <200411020946.09434@vadim.nasardinov> <20041102150849.GB12903@sebster.com> In-Reply-To: <20041102150849.GB12903@sebster.com> X-Enigmail-Version: 0.86.0.0 X-Enigmail-Supports: pgp-inline, pgp-mime Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200411/29 X-Sequence-Number: 11451 Sebastiaan van Erk wrote: > This is indeed part of the code I was talking about. And indeed a > StringBuffer is already a definate improvement. > > However, the setString() method will also cause the data to be duplicated > when escapeString() is called. A version of escapeString() which works > on a StringBuffer would be another improvement in my opinion, saving > (if the allocated StringBuffer is made a bit larger to allow for the > escaping), in most cases another allocation of the whole string. I would point out again that this is all different in the current development driver. escapeString() no longer exists, and the V3 protocol path does not do any additional string escaping as the string is passed directly as a parameter in a Bind message. There's still much scope for improvement, but I'd strongly suggest you use the development driver as a starting point. -O