diff --git a/src/bench/rollingbloom.cpp b/src/bench/rollingbloom.cpp --- a/src/bench/rollingbloom.cpp +++ b/src/bench/rollingbloom.cpp @@ -27,4 +27,12 @@ } } +static void RollingBloomReset(benchmark::State &state) { + CRollingBloomFilter filter(120000, 0.000001); + while (state.KeepRunning()) { + filter.reset(); + } +} + BENCHMARK(RollingBloom, 1500 * 1000); +BENCHMARK(RollingBloomReset, 20000); diff --git a/src/bloom.cpp b/src/bloom.cpp --- a/src/bloom.cpp +++ b/src/bloom.cpp @@ -14,6 +14,8 @@ #include #include +#include + #define LN2SQUARED 0.4804530139182014246671025263266649717305529515945455 #define LN2 0.6931471805599453094172321214581765680755001343602552 @@ -323,7 +325,5 @@ nTweak = GetRand(std::numeric_limits::max()); nEntriesThisGeneration = 0; nGeneration = 1; - for (auto &d : data) { - d = 0; - } + std::fill(data.begin(), data.end(), 0); }