Skip to content
This repository was archived by the owner on Jul 7, 2020. It is now read-only.

Commit fc18269

Browse files
committed
Merge pull request #4 from codahale/pr/CASSANDRA-1220
Improve BloomFilter efficiency
2 parents 5db0ab4 + ed9e9a9 commit fc18269

File tree

1 file changed

+19
-14
lines changed

1 file changed

+19
-14
lines changed

src/main/java/com/clearspring/analytics/stream/membership/BloomCalculations.java

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public class BloomCalculations {
3636
private static final int[] optKPerBuckets =
3737
new int[]{1, // dummy K for 0 buckets per element
3838
1, // dummy K for 1 buckets per element
39-
1, 2, 3, 3, 4, 5, 5, 6, 7, 8, 8, 8, 8, 8};
39+
1, 2, 3, 3, 4, 5, 5, 6, 7, 8, 8, 9, 10, 10, 11, 12, 12, 13, 14};
4040

4141
/**
4242
* In the following table, the row 'i' shows false positive rates if i buckets
@@ -49,19 +49,24 @@ public class BloomCalculations {
4949
{1.0}, // dummy row representing 0 buckets per element
5050
{1.0, 1.0}, // dummy row representing 1 buckets per element
5151
{1.0, 0.393, 0.400},
52-
{1.0, 0.283, 0.237, 0.253},
53-
{1.0, 0.221, 0.155, 0.147, 0.160},
54-
{1.0, 0.181, 0.109, 0.092, 0.092, 0.101}, // 5
55-
{1.0, 0.154, 0.0804, 0.0609, 0.0561, 0.0578, 0.0638},
56-
{1.0, 0.133, 0.0618, 0.0423, 0.0359, 0.0347, 0.0364},
57-
{1.0, 0.118, 0.0489, 0.0306, 0.024, 0.0217, 0.0216, 0.0229},
58-
{1.0, 0.105, 0.0397, 0.0228, 0.0166, 0.0141, 0.0133, 0.0135, 0.0145}, // 9
59-
{1.0, 0.0952, 0.0329, 0.0174, 0.0118, 0.00943, 0.00844, 0.00819, 0.00846},
60-
{1.0, 0.0869, 0.0276, 0.0136, 0.00864, 0.0065, 0.00552, 0.00513, 0.00509},
61-
{1.0, 0.08, 0.0236, 0.0108, 0.00646, 0.00459, 0.00371, 0.00329, 0.00314},
62-
{1.0, 0.074, 0.0203, 0.00875, 0.00492, 0.00332, 0.00255, 0.00217, 0.00199},
63-
{1.0, 0.0689, 0.0177, 0.00718, 0.00381, 0.00244, 0.00179, 0.00146, 0.00129},
64-
{1.0, 0.0645, 0.0156, 0.00596, 0.003, 0.00183, 0.00128, 0.001, 0.000852} // 15
52+
{1.0, 0.283, 0.237, 0.253},
53+
{1.0, 0.221, 0.155, 0.147, 0.160},
54+
{1.0, 0.181, 0.109, 0.092, 0.092, 0.101}, // 5
55+
{1.0, 0.154, 0.0804, 0.0609, 0.0561, 0.0578, 0.0638},
56+
{1.0, 0.133, 0.0618, 0.0423, 0.0359, 0.0347, 0.0364},
57+
{1.0, 0.118, 0.0489, 0.0306, 0.024, 0.0217, 0.0216, 0.0229},
58+
{1.0, 0.105, 0.0397, 0.0228, 0.0166, 0.0141, 0.0133, 0.0135, 0.0145},
59+
{1.0, 0.0952, 0.0329, 0.0174, 0.0118, 0.00943, 0.00844, 0.00819, 0.00846}, // 10
60+
{1.0, 0.0869, 0.0276, 0.0136, 0.00864, 0.0065, 0.00552, 0.00513, 0.00509},
61+
{1.0, 0.08, 0.0236, 0.0108, 0.00646, 0.00459, 0.00371, 0.00329, 0.00314},
62+
{1.0, 0.074, 0.0203, 0.00875, 0.00492, 0.00332, 0.00255, 0.00217, 0.00199, 0.00194},
63+
{1.0, 0.0689, 0.0177, 0.00718, 0.00381, 0.00244, 0.00179, 0.00146, 0.00129, 0.00121, 0.0012},
64+
{1.0, 0.0645, 0.0156, 0.00596, 0.003, 0.00183, 0.00128, 0.001, 0.000852, 0.000775, 0.000744}, // 15
65+
{1.0, 0.0606, 0.0138, 0.005, 0.00239, 0.00139, 0.000935, 0.000702, 0.000574, 0.000505, 0.00047, 0.000459},
66+
{1.0, 0.0571, 0.0123, 0.00423, 0.00193, 0.00107, 0.000692, 0.000499, 0.000394, 0.000335, 0.000302, 0.000287, 0.000284},
67+
{1.0, 0.054, 0.0111, 0.00362, 0.00158, 0.000839, 0.000519, 0.00036, 0.000275, 0.000226, 0.000198, 0.000183, 0.000176},
68+
{1.0, 0.0513, 0.00998, 0.00312, 0.0013, 0.000663, 0.000394, 0.000264, 0.000194, 0.000155, 0.000132, 0.000118, 0.000111, 0.000109},
69+
{1.0, 0.0488, 0.00906, 0.0027, 0.00108, 0.00053, 0.000303, 0.000196, 0.00014, 0.000108, 8.89e-05, 7.77e-05, 7.12e-05, 6.79e-05, 6.71e-05} // 20
6570
}; // the first column is a dummy column representing K=0.
6671

6772
/**

0 commit comments

Comments
 (0)