More efficient bitsliced rolling Bloom filter
This patch changes the implementation from one that stores 16 2-bit integers in one uint32_t's, to one that stores the first bit of 64 2-bit integers in one uint64_t and the second bit in another. This allows for 450x faster refreshing and 2.2x faster average speed.
This commit is contained in:
@@ -514,11 +514,14 @@ BOOST_AUTO_TEST_CASE(rolling_bloom)
|
||||
if (i >= 100)
|
||||
BOOST_CHECK(rb1.contains(data[i-100]));
|
||||
rb1.insert(data[i]);
|
||||
BOOST_CHECK(rb1.contains(data[i]));
|
||||
}
|
||||
|
||||
// Insert 999 more random entries:
|
||||
for (int i = 0; i < 999; i++) {
|
||||
rb1.insert(RandomData());
|
||||
std::vector<unsigned char> d = RandomData();
|
||||
rb1.insert(d);
|
||||
BOOST_CHECK(rb1.contains(d));
|
||||
}
|
||||
// Sanity check to make sure the filter isn't just filling up:
|
||||
nHits = 0;
|
||||
|
||||
Reference in New Issue
Block a user