Return-Path: Delivered-To: apmail-hc-dev-archive@www.apache.org Received: (qmail 63586 invoked from network); 15 Jan 2010 00:23:18 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 15 Jan 2010 00:23:18 -0000 Received: (qmail 44865 invoked by uid 500); 15 Jan 2010 00:23:17 -0000 Delivered-To: apmail-hc-dev-archive@hc.apache.org Received: (qmail 44798 invoked by uid 500); 15 Jan 2010 00:23:17 -0000 Mailing-List: contact dev-help@hc.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "HttpComponents Project" Delivered-To: mailing list dev@hc.apache.org Received: (qmail 44779 invoked by uid 99); 15 Jan 2010 00:23:17 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 15 Jan 2010 00:23:17 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.140] (HELO brutus.apache.org) (140.211.11.140) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 15 Jan 2010 00:23:15 +0000 Received: from brutus.apache.org (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 6B555234C1E9 for ; Thu, 14 Jan 2010 16:22:54 -0800 (PST) Message-ID: <540430552.251571263514974438.JavaMail.jira@brutus.apache.org> Date: Fri, 15 Jan 2010 00:22:54 +0000 (UTC) From: "Tony Poppleton (JIRA)" To: dev@hc.apache.org Subject: [jira] Commented: (HTTPCORE-212) Minor performance improvements In-Reply-To: <1720885405.251261263514734726.JavaMail.jira@brutus.apache.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/HTTPCORE-212?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12800459#action_12800459 ] Tony Poppleton commented on HTTPCORE-212: ----------------------------------------- Also I have unfortunately not given either patch much testing, other than they work in my use case. > Minor performance improvements > ------------------------------ > > Key: HTTPCORE-212 > URL: https://issues.apache.org/jira/browse/HTTPCORE-212 > Project: HttpComponents HttpCore > Issue Type: Improvement > Components: HttpCore > Reporter: Tony Poppleton > Priority: Minor > Attachments: BasicLineParser.java.patch, HttpHost.java.patch > > > JProfiler highlighted a few minor bottlenecks in HttpCore, and two patches are attached. > Neither of these two patches has been benchmarked in a proper fashion, I just observed that they dropped of the JProfiler radar (which isn't a thorough way of doing this and may be wrong!). Could someone with a benchmarking suite already setup please test these patches for performance to confirm they are indeed faster and also if possible ascertain how much faster. > The first patch is to remove the unnecessary creation of a CharArrayBuffer in HttpHost.toHostString. In cases without a port, there is no object creation at all now, and in cases with a port then Java string concatenation is used (and optimized away in recent JVMs). > The second patch is more involved and affects BasicLineParser. Given that all of my responses are being processed with this class, I decided I should look at optimizing it. The main culprit is the string creation in CharArrayBuffer.substringTrimmed which is only required to be able to call the Java Integer.parseInt method. I normally prefer using Java classes where possible, however this patch implements a custom parseInt method which also removes the need for the indexOf operation (so the CharArrayBuffer/String is now only scanned once rather than twice). -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online. --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org For additional commands, e-mail: dev-help@hc.apache.org