Return-Path: Delivered-To: apmail-ws-axis-dev-archive@www.apache.org Received: (qmail 13591 invoked from network); 14 Oct 2004 05:26:35 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur-2.apache.org with SMTP; 14 Oct 2004 05:26:35 -0000 Received: (qmail 99250 invoked by uid 500); 14 Oct 2004 05:26:28 -0000 Delivered-To: apmail-ws-axis-dev-archive@ws.apache.org Received: (qmail 99227 invoked by uid 500); 14 Oct 2004 05:26:28 -0000 Mailing-List: contact axis-dev-help@ws.apache.org; run by ezmlm Precedence: bulk Reply-To: axis-dev@ws.apache.org list-help: list-unsubscribe: list-post: Delivered-To: mailing list axis-dev@ws.apache.org Received: (qmail 99216 invoked by uid 99); 14 Oct 2004 05:26:28 -0000 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received-SPF: pass (hermes.apache.org: local policy) Received: from [203.145.183.216] (HELO geriatrix.itellix.net) (203.145.183.216) by apache.org (qpsmtpd/0.28) with ESMTP; Wed, 13 Oct 2004 22:26:26 -0700 Received: from cacofonix.in.itellix.net (cacofonix.in.itellix.net [10.0.2.13]) by geriatrix.itellix.net (Postfix) with ESMTP id 7CBFE4310DD for ; Thu, 14 Oct 2004 10:39:35 +0530 (IST) Received: from it-nishant.in.itellix.net (it-nishant.in.itellix.net [10.0.2.124]) by cacofonix.in.itellix.net (Postfix) with ESMTP id 5EBFECC006 for ; Thu, 14 Oct 2004 10:59:17 +0530 (IST) Subject: Re: Axis performance and MessageElement.equals() From: Nishant Kumar To: axis-dev@ws.apache.org In-Reply-To: <1097704318.30025.14.camel@batgirl.epokinc.com> References: <1097704318.30025.14.camel@batgirl.epokinc.com> Content-Type: multipart/mixed; boundary="=-9ATMXoOM1szGdI0fmavy" Organization: Message-Id: <1097731748.23500.40.camel@it-nishant> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.2.2 (1.2.2-4) Date: 14 Oct 2004 10:59:10 +0530 X-Virus-Checked: Checked X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N --=-9ATMXoOM1szGdI0fmavy Content-Type: text/plain Content-Transfer-Encoding: 7bit hi, this is exactly the second point i have mentioned at http://nishantkumar.com/notes/tuning/axis.html. I have also suggested a simple solution for this which will apply for most of the situations. this time i am attaching a patch for src/org/apache/axis/message/NodeImpl.java and src/org/apache/axis/message/MessageElement.java these two patches will solve the problem, most of the time. this will surely boost performance. you can have look at these patches to find out what i mean by most of the time. i will attach these patches in http://issues.apache.org/jira/browse/AXIS-1497 too. thanks, nishant On Thu, 2004-10-14 at 03:21, Steve Green wrote: > Developers, > > I've been doing some performance profiling and I stumbled into > MessageElement.equals(). Is there any reason why the equals method > needs to compare strings? Can it not just compare the objects? > > The reason I ask is because of because of NodeImpl. NodeImpl keeps an > ArrayList of children. Many of the operations in NodeImpl use > ArrayList.indexOf() which calls equals(). Isn't it the case that > removeChild(), insertBefore(), etc... should be looking for a specific > object, not an object that looks the same? While we're at it, shouldn't > removeChild() return after finding the child? Currently, it continues > to search for more children that equals() the child to remove. The DOM > documents are not clear on this. > > Thank you. > > ~S > --=-9ATMXoOM1szGdI0fmavy Content-Disposition: attachment; filename=MessageElement.diff Content-Type: text/x-patch; name=MessageElement.diff; charset=UTF-8 Content-Transfer-Encoding: 7bit Index: src/org/apache/axis/message/MessageElement.java =================================================================== RCS file: /home/cvspublic/ws-axis/java/src/org/apache/axis/message/MessageElement.java,v retrieving revision 1.183 diff -c -w -r1.183 MessageElement.java *** src/org/apache/axis/message/MessageElement.java 12 Oct 2004 13:52:13 -0000 1.183 --- src/org/apache/axis/message/MessageElement.java 14 Oct 2004 05:15:55 -0000 *************** *** 1985,1990 **** --- 1985,1997 ---- if (obj == null || !(obj instanceof MessageElement)) { return false; } + if (this == obj) { + return true; + } + MessageElement messageElement = (MessageElement) obj; + if (!this.getLocalName().equals(messageElement.getLocalName())) { + return false; + } return toString().equals(obj.toString()); } --=-9ATMXoOM1szGdI0fmavy Content-Disposition: attachment; filename=NodeImpl.diff Content-Type: text/x-patch; name=NodeImpl.diff; charset=UTF-8 Content-Transfer-Encoding: 7bit Index: src/org/apache/axis/message/NodeImpl.java =================================================================== RCS file: /home/cvspublic/ws-axis/java/src/org/apache/axis/message/NodeImpl.java,v retrieving revision 1.4 diff -c -w -r1.4 NodeImpl.java *** src/org/apache/axis/message/NodeImpl.java 7 Sep 2004 09:32:48 -0000 1.4 --- src/org/apache/axis/message/NodeImpl.java 14 Oct 2004 05:16:46 -0000 *************** *** 478,485 **** public Node removeChild(Node oldChild) throws DOMException { boolean removed = false; initializeChildren(); ! int position = children.indexOf(oldChild); ! if (position < 0) { throw new DOMException(DOMException.NOT_FOUND_ERR, "NodeImpl Not found"); } --- 478,501 ---- public Node removeChild(Node oldChild) throws DOMException { boolean removed = false; initializeChildren(); ! if (oldChild == null) { ! throw new DOMException(DOMException.NOT_FOUND_ERR, ! "NodeImpl Not found"); ! } ! final Iterator itr = children.iterator(); ! final String oldChildLocalName = oldChild.getLocalName(); ! while (itr.hasNext()) { ! Node node = (Node) itr.next(); ! if (oldChild == node) { ! removed = true; ! itr.remove(); ! } ! else if (oldChildLocalName.equals(node.getLocalName())) ! { ! if (no) ! } ! } ! if (!removed) { throw new DOMException(DOMException.NOT_FOUND_ERR, "NodeImpl Not found"); } --=-9ATMXoOM1szGdI0fmavy--