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

    https://github.com/apache/activemq-artemis/pull/1757#discussion_r160255842
  
    --- 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 --
    
    I don't see the benefit of this change, for GC.
    
    Why i moved the equals code between two byte arrays into ByteUtil and 
re-used the equals, was to keep the logic that is checked equal between the 
bytebuf equals and the equals of the String the same called code. Adding these 
extra checks, could allow for differences in result now, and for very marginal 
improvement at best IMO.


---

Reply via email to