diff options
author | tedyu <yuzhihong@gmail.com> | 2015-05-07 16:53:59 -0700 |
---|---|---|
committer | Josh Rosen <joshrosen@databricks.com> | 2015-05-07 16:55:34 -0700 |
commit | 88063c62689135da56ee6678b2e826b88c382732 (patch) | |
tree | 5c49a6d221fb8416594e186eae1daa7348a54630 /unsafe/src/test | |
parent | 35f0173b8f67e2e506fc4575be6430cfb66e2238 (diff) | |
download | spark-88063c62689135da56ee6678b2e826b88c382732.tar.gz spark-88063c62689135da56ee6678b2e826b88c382732.tar.bz2 spark-88063c62689135da56ee6678b2e826b88c382732.zip |
[SPARK-7450] Use UNSAFE.getLong() to speed up BitSetMethods#anySet()
Author: tedyu <yuzhihong@gmail.com>
Closes #5897 from tedyu/master and squashes the following commits:
473bf9d [tedyu] Address Josh's review comments
1719c5b [tedyu] Correct upper bound in for loop
b51dcaf [tedyu] Add unit test in BitSetSuite for BitSet#anySet()
83f9f87 [tedyu] Merge branch 'master' of github.com:apache/spark
817e3f9 [tedyu] Replace constant 8 with SIZE_OF_LONG
75a467b [tedyu] Correct offset for UNSAFE.getLong()
855374b [tedyu] Remove second loop since bitSetWidthInBytes is WORD aligned
093b7a4 [tedyu] Use UNSAFE.getLong() to speed up BitSetMethods#anySet()
63ee050 [tedyu] Use UNSAFE.getLong() to speed up BitSetMethods#anySet()
4ca0ef6 [tedyu] Use UNSAFE.getLong() to speed up BitSetMethods#anySet()
3e9b6919 [tedyu] Use UNSAFE.getLong() to speed up BitSetMethods#anySet()
Diffstat (limited to 'unsafe/src/test')
-rw-r--r-- | unsafe/src/test/java/org/apache/spark/unsafe/bitset/BitSetSuite.java | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/unsafe/src/test/java/org/apache/spark/unsafe/bitset/BitSetSuite.java b/unsafe/src/test/java/org/apache/spark/unsafe/bitset/BitSetSuite.java index e3a824e29b..18393db9f3 100644 --- a/unsafe/src/test/java/org/apache/spark/unsafe/bitset/BitSetSuite.java +++ b/unsafe/src/test/java/org/apache/spark/unsafe/bitset/BitSetSuite.java @@ -39,6 +39,8 @@ public class BitSetSuite { for (int i = 0; i < bs.capacity(); i++) { Assert.assertFalse(bs.isSet(i)); } + // another form of asserting that the bit set is empty + Assert.assertFalse(bs.anySet()); // Set every bit and check it. for (int i = 0; i < bs.capacity(); i++) { @@ -52,6 +54,11 @@ public class BitSetSuite { bs.unset(i); Assert.assertFalse(bs.isSet(i)); } + + // Make sure anySet() can detect any set bit + bs = createBitSet(256); + bs.set(64); + Assert.assertTrue(bs.anySet()); } @Test |