1 // Copyright (c) 2016 The Bitcoin Core developers
2 // Distributed under the MIT software license, see the accompanying
3 // file COPYING or http://www.opensource.org/licenses/mit-license.php.
11 static void RollingBloom(benchmark::State
& state
)
13 CRollingBloomFilter
filter(120000, 0.000001);
14 std::vector
<unsigned char> data(32);
16 uint32_t nEntriesPerGeneration
= (120000 + 1) / 2;
17 uint32_t countnow
= 0;
19 while (state
.KeepRunning()) {
23 data
[2] = count
>> 16;
24 data
[3] = count
>> 24;
25 if (countnow
== nEntriesPerGeneration
) {
26 int64_t b
= GetTimeMicros();
28 int64_t e
= GetTimeMicros();
29 std::cout
<< "RollingBloom-refresh,1," << (e
-b
)*0.000001 << "," << (e
-b
)*0.000001 << "," << (e
-b
)*0.000001 << "\n";
35 data
[0] = count
>> 24;
36 data
[1] = count
>> 16;
39 match
+= filter
.contains(data
);
43 BENCHMARK(RollingBloom
);