[ 
https://issues.apache.org/jira/browse/DEFT-112?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13070002#comment-13070002
 ] 

Roger Schildmeijer edited comment on DEFT-112 at 7/24/11 9:17 AM:
------------------------------------------------------------------

Currently we allocate (malloc (relatively slow) + memset (fill with zeros, 
fast)) a new BB everytime we receive the handleRead callback. 

Proposal: At the end of the first handleRead callback we could attach the 
"used" (and newly allocated) bb on the SelectionKey, and have an if statement 
like:

  if (key.attachment() != null) { reuse the attached bb}

 The reuse would eliminate the execessive allocating of new byte buffers 
(atleast to some extent. a byte buffer pool could be next step forward)

      was (Author: rschildmeijer):
    Currently we allocate a new BB everytime we receive the handleRead 
callback. 

Proposal: At the end of the first handleRead callback we could attach the 
"used" (and newly allocated) bb on the SelectionKey, and have an if statement 
like:

  if (key.attachment() != null) { reuse the attached bb}

 
  
> Optimized ByteBuffer usage in AsynchronousSocket
> ------------------------------------------------
>
>                 Key: DEFT-112
>                 URL: https://issues.apache.org/jira/browse/DEFT-112
>             Project: Deft
>          Issue Type: Improvement
>
> The ByteBuffer usage is HttpProtocol is pretty optimized (bytebuffer reusage 
> etc). Apply the similiar usage in AS

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to