aboutsummaryrefslogtreecommitdiff
path: root/src/bench/rollingbloom.cpp
diff options
context:
space:
mode:
authorWladimir J. van der Laan <laanwj@gmail.com>2017-12-23 14:46:20 +0100
committerWladimir J. van der Laan <laanwj@gmail.com>2017-12-23 14:53:05 +0100
commit5180a86c96bc05d2a731f70f36aae28ab5a3fad4 (patch)
tree2339b7b14ec174861d1baa73a44a33680644f820 /src/bench/rollingbloom.cpp
parent20166f8a448156f476f3e23825f59ebec36424a9 (diff)
parent760af84072408ba53d009e868fccc25fb186d40c (diff)
Merge #11517: Tests: Improve benchmark precision
760af84 Removed CCheckQueueSpeed benchmark (Martin Ankerl) 00721e6 Improved microbenchmarking with multiple features. (Martin Ankerl) Pull request description: The benchmark's KeepRunning() used to make a function call for each call, inflating measurement times for short running code. This change inlines the critical code that is executed each run and moves the slow timer updates into a new function. This change increases the average runtime for Trig from 0.000000082339208 sec to 0.000000080948591. Tree-SHA512: 36b3bc55fc9b1d4cbf526b7103af6af18e9783e6b8f3ad3adbd09fac0bf9401cfefad58fd1e6fa2615d3c4e677998f912f3323d61d7b00b1c660d581c257d577
Diffstat (limited to 'src/bench/rollingbloom.cpp')
-rw-r--r--src/bench/rollingbloom.cpp16
1 files changed, 3 insertions, 13 deletions
diff --git a/src/bench/rollingbloom.cpp b/src/bench/rollingbloom.cpp
index 452099b800..031355c06e 100644
--- a/src/bench/rollingbloom.cpp
+++ b/src/bench/rollingbloom.cpp
@@ -12,8 +12,6 @@ static void RollingBloom(benchmark::State& state)
CRollingBloomFilter filter(120000, 0.000001);
std::vector<unsigned char> data(32);
uint32_t count = 0;
- uint32_t nEntriesPerGeneration = (120000 + 1) / 2;
- uint32_t countnow = 0;
uint64_t match = 0;
while (state.KeepRunning()) {
count++;
@@ -21,16 +19,8 @@ static void RollingBloom(benchmark::State& state)
data[1] = count >> 8;
data[2] = count >> 16;
data[3] = count >> 24;
- if (countnow == nEntriesPerGeneration) {
- auto b = benchmark::clock::now();
- filter.insert(data);
- auto total = std::chrono::duration_cast<std::chrono::nanoseconds>(benchmark::clock::now() - b).count();
- std::cout << "RollingBloom-refresh,1," << total << "," << total << "," << total << "\n";
- countnow = 0;
- } else {
- filter.insert(data);
- }
- countnow++;
+ filter.insert(data);
+
data[0] = count >> 24;
data[1] = count >> 16;
data[2] = count >> 8;
@@ -39,4 +29,4 @@ static void RollingBloom(benchmark::State& state)
}
}
-BENCHMARK(RollingBloom);
+BENCHMARK(RollingBloom, 1500 * 1000);