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

ASF GitHub Bot commented on PROTON-1965:
----------------------------------------

Github user franz1981 commented on a diff in the pull request:

    https://github.com/apache/qpid-proton-j/pull/20#discussion_r234719950
  
    --- Diff: 
proton-j/src/main/java/org/apache/qpid/proton/codec/CompositeReadableBuffer.java
 ---
    @@ -834,22 +834,39 @@ public boolean equals(Object other) {
                 return false;
             }
     
    -        ReadableBuffer buffer = (ReadableBuffer)other;
    -        if (this.remaining() != buffer.remaining()) {
    +        ReadableBuffer buffer = (ReadableBuffer) other;
    +        final int remaining = remaining();
    +        if (remaining != buffer.remaining()) {
                 return false;
             }
    +        if (hasArray()) {
    +            return equals(currentArray, position, remaining, buffer);
    --- End diff --
    
    So ti should take into account the arrayOffset and do not rely on position?



> Optimize CompositeReadableBuffer::equals with single chunk
> ----------------------------------------------------------
>
>                 Key: PROTON-1965
>                 URL: https://issues.apache.org/jira/browse/PROTON-1965
>             Project: Qpid Proton
>          Issue Type: Improvement
>    Affects Versions: proton-j-0.30.0
>            Reporter: Francesco Nigro
>            Priority: Minor
>
> CompositeReadableBuffer::equals with single chunk could be optimized in order 
> to 
> access directly the single array chunk to speed up memory accesses.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to