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

ASF GitHub Bot commented on ARTEMIS-1586:
-----------------------------------------

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

    https://github.com/apache/activemq-artemis/pull/1757#discussion_r160347432
  
    --- Diff: 
artemis-commons/src/main/java/org/apache/activemq/artemis/api/core/SimpleString.java
 ---
    @@ -259,22 +281,23 @@ public boolean equals(final Object other) {
           if (other instanceof SimpleString) {
              SimpleString s = (SimpleString) other;
     
    -         if (data.length != s.data.length) {
    -            return false;
    -         }
    -
    -         for (int i = 0; i < data.length; i++) {
    -            if (data[i] != s.data[i]) {
    -               return false;
    -            }
    -         }
    -
    -         return true;
    +         return ByteUtil.equals(data, s.data);
    --- End diff --
    
    And there is a correctness issue around it (in my code too!!!): 
    if `s` is `null` `s.data` will throw NPE!


> Reduce GC pressure due to String allocations on Core protocol
> -------------------------------------------------------------
>
>                 Key: ARTEMIS-1586
>                 URL: https://issues.apache.org/jira/browse/ARTEMIS-1586
>             Project: ActiveMQ Artemis
>          Issue Type: Improvement
>            Reporter: Francesco Nigro
>            Assignee: Francesco Nigro
>
> The core protocol produce a huge amount of StringValue/SimpleString instances 
> during CoreMessage decoding of SessionSendMessages.
> Often these instances are the same during the lifetime of a client/server 
> connection: providing efficient interners would help to reduce the GC 
> pressure, increasing the broker capacity/scalability.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to