aboutsummaryrefslogtreecommitdiff
path: root/src/test
diff options
context:
space:
mode:
authorPieter Wuille <pieter.wuille@gmail.com>2016-04-24 18:37:29 +0200
committerPieter Wuille <pieter.wuille@gmail.com>2016-04-28 14:56:32 +0200
commit1953c40aa9589a03035fd294f3ba3549374a4826 (patch)
tree5b8d6f7d7dbdb8852642339d54050693626d277b /src/test
parentaa62b68745ef43ca135fdffbd886818221e85731 (diff)
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.
Diffstat (limited to 'src/test')
-rw-r--r--src/test/bloom_tests.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/test/bloom_tests.cpp b/src/test/bloom_tests.cpp
index 9557000ddc..042fad42da 100644
--- a/src/test/bloom_tests.cpp
+++ b/src/test/bloom_tests.cpp
@@ -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;