You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hc.apache.org by "Oleg Kalnichevski (JIRA)" <ji...@apache.org> on 2008/12/24 14:24:44 UTC

[jira] Created: (HTTPCORE-177) Optimize AbstractSessionInputBuffer#read(byte[], int, int)

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


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: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


[jira] Resolved: (HTTPCORE-177) Optimize AbstractSessionInputBuffer#read(byte[], int, int)

Posted by "Oleg Kalnichevski (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HTTPCORE-177?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Oleg Kalnichevski resolved HTTPCORE-177.
----------------------------------------

    Resolution: Fixed

Fix committed to SVN trunk. I am seeing some marginal (3-5%) performance improvement on Windows.

Oleg

> 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: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


[jira] Commented: (HTTPCORE-177) Optimize AbstractSessionInputBuffer#read(byte[], int, int)

Posted by "Tony Poppleton (JIRA)" <ji...@apache.org>.
    [ 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: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


[jira] Updated: (HTTPCORE-177) Optimize AbstractSessionInputBuffer#read(byte[], int, int)

Posted by "Oleg Kalnichevski (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HTTPCORE-177?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Oleg Kalnichevski updated HTTPCORE-177:
---------------------------------------

    Fix Version/s:     (was: 4.1)
                   4.1-beta1

> 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: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


[jira] Commented: (HTTPCORE-177) Optimize AbstractSessionInputBuffer#read(byte[], int, int)

Posted by "Oleg Kalnichevski (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HTTPCORE-177?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12801192#action_12801192 ] 

Oleg Kalnichevski commented on HTTPCORE-177:
--------------------------------------------

My idea was pretty trivial - copy data to the internal buffer only when reading small chunks of data. When reading largish chunks the method should read to the destination buffer directly bypassing the internal buffer. 

One byte reads are not a problem. In fact, the internal buffer never gets compacted. #fillBuffer() is called only when content of the buffer is completely exhausted. 

Oleg

> 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: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org