Return-Path: Delivered-To: apmail-ibatis-user-java-archive@www.apache.org Received: (qmail 49573 invoked from network); 2 Aug 2006 19:33:10 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 2 Aug 2006 19:33:10 -0000 Received: (qmail 21246 invoked by uid 500); 2 Aug 2006 19:33:08 -0000 Delivered-To: apmail-ibatis-user-java-archive@ibatis.apache.org Received: (qmail 21228 invoked by uid 500); 2 Aug 2006 19:33:08 -0000 Mailing-List: contact user-java-help@ibatis.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user-java@ibatis.apache.org Delivered-To: mailing list user-java@ibatis.apache.org Received: (qmail 21212 invoked by uid 99); 2 Aug 2006 19:33:08 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 02 Aug 2006 12:33:08 -0700 X-ASF-Spam-Status: No, hits=0.5 required=10.0 tests=DNS_FROM_RFC_ABUSE,HTML_MESSAGE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: domain of jeffgbutler@gmail.com designates 66.249.92.169 as permitted sender) Received: from [66.249.92.169] (HELO ug-out-1314.google.com) (66.249.92.169) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 02 Aug 2006 12:33:05 -0700 Received: by ug-out-1314.google.com with SMTP id m2so2311593ugc for ; Wed, 02 Aug 2006 12:32:43 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:references; b=rMaso3xF8NZTe55sRDjqvK3Kp/kArMaWRaDb/sIp8X7SgDV602UpKumzxpcRIQg9syKPAe8h1MLB/2nColy+usnEQNQ7sCdbbCwJSOl47qsPofxk6DFBg6QuVbsjQoKJXVIW8fIYrFNW7KCp2+V3Wq8B8t8dIa1E+YaC/cHdJAc= Received: by 10.66.222.9 with SMTP id u9mr1582991ugg; Wed, 02 Aug 2006 12:32:43 -0700 (PDT) Received: by 10.66.221.15 with HTTP; Wed, 2 Aug 2006 12:32:42 -0700 (PDT) Message-ID: Date: Wed, 2 Aug 2006 14:32:42 -0500 From: "Jeff Butler" To: user-java@ibatis.apache.org Subject: Re: Is PreparedStatement reused on insert? In-Reply-To: <3A68DD30-AEB5-4086-925F-30FA16C67F46@gmail.com> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_127252_25029821.1154547162963" References: <3A68DD30-AEB5-4086-925F-30FA16C67F46@gmail.com> X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N ------=_Part_127252_25029821.1154547162963 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline If you use a batch, then the prepared statement will be reused. The latest developer guide has lots of information about batches. Jeff Butler On 8/2/06, Kenji Nakamura wrote: > > Hi, > > I'm evaluating iBatis 2.1.7, and encountered a performance problem. > The benchmark is simply taking a sequential file with approximately > 16,000 lines, and populate them into HSQLDB (1.8.0.1) with 20 lines > of batch. I see iBatis version is two to three times slower than > plain vanilla JDBC version. > I put a profiler, and it indicates > com.ibatis.sqlmap.engine.execution.SqlExecutor#excuteUpdate() creates > an instance of PreparedStatement every time calling > SqlMapClient#insert(), and it is actually created at line 77 of the > method. > Is there a way to keep an instance of PreparedStatement for an Id and > reuse it? At least creation of PreparedStatement isn't a cheap > operation in HSQLDB, which takes up 51% of whole execution time in my > benchmark. > > Thanks in advance, > > Kenji > > ------=_Part_127252_25029821.1154547162963 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline
If you use a batch, then the prepared statement will be reused.  The latest developer guide has lots of information about batches.
 
Jeff Butler


 
On 8/2/06, Kenji Nakamura <nakamura.kenji@gmail.com> wrote:
Hi,

I'm evaluating iBatis 2.1.7, and encountered a performance problem.
The benchmark is simply taking a sequential file with approximately
16,000 lines, and populate them into HSQLDB (1.8.0.1) with 20 lines
of batch. I see iBatis version is two to three times slower than
plain vanilla JDBC version.
I put a profiler, and it indicates
com.ibatis.sqlmap.engine.execution.SqlExecutor#excuteUpdate() creates
an instance of PreparedStatement every time calling
SqlMapClient#insert(), and it is actually created at line 77 of the
method.
Is there a way to keep an instance of PreparedStatement for an Id and
reuse it? At least creation of PreparedStatement isn't a cheap
operation in HSQLDB, which takes up 51% of whole execution time in my
benchmark.

Thanks in advance,

Kenji


------=_Part_127252_25029821.1154547162963--