diff --git a/src/bench/rollingbloom.cpp b/src/bench/rollingbloom.cpp index 43e2bd719..3ccc3ab78 100644 --- a/src/bench/rollingbloom.cpp +++ b/src/bench/rollingbloom.cpp @@ -1,30 +1,38 @@ // Copyright (c) 2016 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #include #include #include static void RollingBloom(benchmark::State &state) { CRollingBloomFilter filter(120000, 0.000001); std::vector data(32); uint32_t count = 0; while (state.KeepRunning()) { count++; data[0] = count; data[1] = count >> 8; data[2] = count >> 16; data[3] = count >> 24; filter.insert(data); data[0] = count >> 24; data[1] = count >> 16; data[2] = count >> 8; data[3] = count; filter.contains(data); } } +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 index b74dbb8d8..36a6e606a 100644 --- a/src/bloom.cpp +++ b/src/bloom.cpp @@ -1,329 +1,329 @@ // Copyright (c) 2012-2016 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #include #include #include #include #include