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

    https://github.com/apache/spark/pull/14762#discussion_r78978059
  
    --- Diff: 
common/unsafe/src/main/java/org/apache/spark/unsafe/array/ByteArrayMethods.java 
---
    @@ -47,13 +47,20 @@ public static int roundNumberOfBytesToNearestWord(int 
numBytes) {
       public static boolean arrayEquals(
           Object leftBase, long leftOffset, Object rightBase, long 
rightOffset, final long length) {
         int i = 0;
    -    while (i <= length - 8) {
    -      if (Platform.getLong(leftBase, leftOffset + i) !=
    -        Platform.getLong(rightBase, rightOffset + i)) {
    -        return false;
    -      }
    -      i += 8;
    -    }
    +
    +      // This attempts to speed up the memcmp type of operation, but there 
is no way
    +      // to guarantee that the offsets will be on a word boundary in order 
to use
    +      // Platform.getLong
    --- End diff --
    
    No.  The only way it can be used with the 8 byte copy is if both leftOffset 
and rightOffset either start on proper word boundries, or are off of boundries 
by the same degree.  In practice, this absolute alignment between left and 
right offsets happens very rarely.  So rarely that the performance impact of 
checking for it every time negates any advantage you get from performing it.  


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

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

Reply via email to