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

    https://github.com/apache/spark/pull/18231#discussion_r120943066
  
    --- Diff: 
common/network-shuffle/src/main/java/org/apache/spark/network/shuffle/ExternalShuffleBlockHandler.java
 ---
    @@ -209,4 +190,51 @@ private ShuffleMetrics() {
         }
       }
     
    +  private class ManagedBufferIterator implements Iterator<ManagedBuffer> {
    +
    +    private int index = 0;
    +    private String appId;
    +    private String execId;
    +    private String shuffleId;
    +    // An array containing mapId and reduceId pairs.
    +    private int[][] mapIdAndReduceIds;
    --- End diff --
    
    Actually, I mean a single array. e.g.
    
    ```
    int[] mapIdAndReduceIds;
    
    mapIdAndReduceIds = new int[blockIds.length * 2];
    mapIdAndReduceIds[0] = mapId1;
    mapIdAndReduceIds[1] = reduceId1;
    mapIdAndReduceIds[2] = mapId2;
    mapIdAndReduceIds[3] = reduceId2;
    etc etc etc
    ```
    
    Reason being that if you really have millions of these, each "child" array 
in your two-dimensional array wastes 16 (or 20?) bytes (16 bytes of object 
overhead + 4 bytes for the array length). Looking in jvisual vm, an empty array 
actually consumes 24 bytes, so it seems the JVM is aligning things and wasting 
an extra 4 bytes per array...


---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to