[ 
https://issues.apache.org/jira/browse/HTTPCORE-212?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12800654#action_12800654
 ] 

Oleg Kalnichevski commented on HTTPCORE-212:
--------------------------------------------

I second that. If we decide to make use of final local variables we should do 
that consistently across the entire code base. 

As to BasicLineParser optimization, we used to have a custom integer parsing 
routine but eventually decided that this kind of microoptimization was not 
worth the trouble. This was many moons ago, though, so, I do not mind 
revisiting the decision. Having said that it would be nice to have some 
empirical evidence of performance improvement. You may want to take a look at 
the httpclient-benchmark code that I usually use for comparing HttpClient 
performance in terms of raw data / request throughput.

http://svn.apache.org/repos/asf/httpcomponents/httpclient/trunk/httpclient-benchmark/

Oleg

PS: If you happen to have some bandwidth for looking into HttpCore performance 
optimization, you might want to have a brief look at fixing HTTPCORE-177, which 
I believe should result in a tangible performance improvement.


> 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, BasicLineParser.java.patch2, 
> HttpHost.java.patch, HttpHost.java.patch2
>
>
> 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: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to