Return-Path: Delivered-To: apmail-db-derby-dev-archive@www.apache.org Received: (qmail 42192 invoked from network); 10 Apr 2006 17:55:39 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 10 Apr 2006 17:55:37 -0000 Received: (qmail 4871 invoked by uid 500); 10 Apr 2006 17:55:27 -0000 Delivered-To: apmail-db-derby-dev-archive@db.apache.org Received: (qmail 4803 invoked by uid 500); 10 Apr 2006 17:55:27 -0000 Mailing-List: contact derby-dev-help@db.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: Delivered-To: mailing list derby-dev@db.apache.org Received: (qmail 4629 invoked by uid 99); 10 Apr 2006 17:55:26 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 10 Apr 2006 10:55:26 -0700 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received: from [192.87.106.226] (HELO ajax.apache.org) (192.87.106.226) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 10 Apr 2006 10:55:25 -0700 Received: from ajax (localhost.localdomain [127.0.0.1]) by ajax.apache.org (Postfix) with ESMTP id A127D6ACAE for ; Mon, 10 Apr 2006 18:55:04 +0100 (BST) Message-ID: <307924145.1144691704657.JavaMail.jira@ajax> Date: Mon, 10 Apr 2006 18:55:04 +0100 (BST) From: "Dyre Tjeldvoll (JIRA)" To: derby-dev@db.apache.org Subject: [jira] Closed: (DERBY-825) writeSQLCAGRP() should use byte[] constants instead of Strings where feasible In-Reply-To: <1385762211.1137658842399.JavaMail.jira@ajax.apache.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N [ http://issues.apache.org/jira/browse/DERBY-825?page=all ] Dyre Tjeldvoll closed DERBY-825: -------------------------------- Resolution: Fixed > writeSQLCAGRP() should use byte[] constants instead of Strings where feasible > ----------------------------------------------------------------------------- > > Key: DERBY-825 > URL: http://issues.apache.org/jira/browse/DERBY-825 > Project: Derby > Type: Sub-task > Components: Network Server, Performance > Versions: 10.1.2.1 > Reporter: Dyre Tjeldvoll > Assignee: Dyre Tjeldvoll > Priority: Minor > Fix For: 10.1.3.0 > Attachments: derby-825.diff, derby-825.stat, derbynetclientmats_report.txt > > writeSQLCAGRP() writes Strings into the message being built. Profiling shows that it is more expensive to write a String than a byte[] because the String must be converted to UTF8. writeSQLCAGRP() writes 5 bytes for SQLState, and this is done by either writing a String constant, or the return value from SQLException.getSQLState(). For the common case where there is no exception (SQLState = 5xspace), or the exception is a "dummy" exception (SQLState=00000 or 02000, End of Data), this is wasteful because the String has to be converted to byte[] each time, and in the case of the dummy exception, a new String object will be created each time getSQLState() is called, even if the exception object is the same (there is no caching, which is reasonable since exceptions are meant to be thrown, not kept around for a long time). > A solution is to keep the commonly used SQLStates as byte[] constants that can be inserted into the message with writeBytes(). > If writeSQLCAGRP() is called with no SQLException (null) there is no attempt to put an internationalized error message into the outgoing message (The third argument to writeSQLCAXGRP() is null). This is reasonable, but the same optimization is not done when the exception is one of the dummy exceptions mentioned previously. In this case an internationalized version of the message "End of Data" is constructed and inserted into the message. It would be better to call writeSQLCAXGRP(..,null,..) in this case as well, since it isn't needed by the client in this case. > Finally, writeSQLCAERRWARN() uses writeScalarPaddedBytes() to write values that also can be stored as byte[] constants, and written faster with writeBytes() > -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira