aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/bench/gcs_filter.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/bench/gcs_filter.cpp b/src/bench/gcs_filter.cpp
index 0b43652453..80babb213b 100644
--- a/src/bench/gcs_filter.cpp
+++ b/src/bench/gcs_filter.cpp
@@ -8,7 +8,12 @@
static const GCSFilter::ElementSet GenerateGCSTestElements()
{
GCSFilter::ElementSet elements;
- for (int i = 0; i < 10000; ++i) {
+
+ // Testing the benchmarks with different number of elements show that a filter
+ // with at least 100,000 elements results in benchmarks that have the same
+ // ns/op. This makes it easy to reason about how long (in nanoseconds) a single
+ // filter element takes to process.
+ for (int i = 0; i < 100000; ++i) {
GCSFilter::Element element(32);
element[0] = static_cast<unsigned char>(i);
element[1] = static_cast<unsigned char>(i >> 8);
@@ -35,7 +40,7 @@ static void GCSFilterConstruct(benchmark::Bench& bench)
auto elements = GenerateGCSTestElements();
uint64_t siphash_k0 = 0;
- bench.batch(elements.size()).unit("elem").run([&] {
+ bench.run([&]{
GCSFilter filter({siphash_k0, 0, BASIC_FILTER_P, BASIC_FILTER_M}, elements);
siphash_k0++;