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

Tony Poppleton commented on HTTPCORE-177:
-----------------------------------------

One possible implementation would be for any read method to always fill up the 
buffer completely from 0 to the buffer size.  The buffer would then be 
processed appropriately by each method, until the buffer position hits the end 
of the buffer, at which point a whole new buffer would be read in entirely 
replacing the previous buffer content.

This would remove the compacting of the buffer in fillBuffer().  If I 
understand the code correctly, then if you were to call the single byte read 
method repeatedly then it would continually shift the whole buffer back by 1, 
and then read in a single byte from the stream to fill the gap?  I may have 
misunderstood though, as that seems very inefficient.

Anyway, would this implementation work?  I have not studied the class is enough 
detail about exactly how each method processes the buffer to know yet...

> Optimize AbstractSessionInputBuffer#read(byte[], int, int)
> ----------------------------------------------------------
>
>                 Key: HTTPCORE-177
>                 URL: https://issues.apache.org/jira/browse/HTTPCORE-177
>             Project: HttpComponents HttpCore
>          Issue Type: Improvement
>          Components: HttpCore
>    Affects Versions: 4.0-beta3
>            Reporter: Oleg Kalnichevski
>             Fix For: 4.1-beta1
>
>
> At the moment AbstractSessionInputBuffer#read(byte[], int, int) always copies 
> input to the internal data buffer prior to copying it to the destination 
> buffer. The performance of this method may potentially be improved by 
> eliminating intermediate data copy operation and reading input directly to 
> the destination buffer, especially when dealing with large chunks.
> Oleg

-- 
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