GitHub user davies opened a pull request:

    https://github.com/apache/spark/pull/9452

    [SPARK-11493] remove bitset from BytesToBytesMap

    Since we have 4 bytes as number of records in the beginning of a page, the 
address can not be zero, so we do not need the bitset.
    
    For performance concerns, the bitset could help speed up false lookup if 
the slot is empty (because bitset is smaller than longArray, cache hit rate 
will be higher). In practice, the map is filled with 35% - 70% (use 50% as 
average), so only half of the false lookups can benefit of it, all others will 
pay the cost of load the bitset (still need to access the longArray anyway).
    
    For aggregation, we always need to access the longArray (insert a new key 
after false lookup), also confirmed by a benchmark.
    
     For broadcast hash join, there could be a regression, but a simple 
benchmark showed that it may not (most of lookup are false):
    
    ```
    sqlContext.range(1<<20).write.parquet("small")
    df = sqlContext.read.parquet('small')
    for i in range(3):
        t = time.time()
        df2 = sqlContext.range(1<<26)
        df2.join(df, df.id == df2.id).count()
        print time.time() -t
    ```
    
    Having bitset (used time in seconds):
    ```
    15.9311430454
    11.19282794
    9.98717904091
    ```
    After removing bitset (used time in seconds):
    ```
    14.6036689281
    9.53816604614
    8.95434498787
    ``` 
    
    cc @rxin @nongli 

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/davies/spark remove_bitset

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/spark/pull/9452.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #9452
    
----
commit 6ea56eaf35762df5c04440a6005ccf3bf88dabde
Author: Davies Liu <[email protected]>
Date:   2015-11-03T22:49:38Z

    remove bitset

----


---
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