Skip to content

Commit e734228

Browse files
committed
Update GCSFilter benchmarks
Element count used in the GCSFilter benchmarks are increased to 100,000 from 10,000. Testing the benchmarks with different element counts showed that a filter with 100,000 elements resulted in the same ns/op. This this a desirable thing to have as it allows us to reason about how long a single filter element takes to process, letting us easily calculate how long a filter with N elements (where N > 100,000) would take to process. GCSFilterConstruct benchmark is now called without batch. This makes intra-bench results more intuitive as all benchmarks are in ns/op instead of a custom unit. There are no downsides to this change as testing showed that there is no observable difference in error rates in the benchmarks when calling without batch.
1 parent aee9a81 commit e734228

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/bench/gcs_filter.cpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,12 @@
88
static const GCSFilter::ElementSet GenerateGCSTestElements()
99
{
1010
GCSFilter::ElementSet elements;
11-
for (int i = 0; i < 10000; ++i) {
11+
12+
// Testing the benchmarks with different number of elements show that a filter
13+
// with at least 100,000 elements results in benchmarks that have the same
14+
// ns/op. This makes it easy to reason about how long (in nanoseconds) a single
15+
// filter element takes to process.
16+
for (int i = 0; i < 100000; ++i) {
1217
GCSFilter::Element element(32);
1318
element[0] = static_cast<unsigned char>(i);
1419
element[1] = static_cast<unsigned char>(i >> 8);
@@ -35,7 +40,7 @@ static void GCSFilterConstruct(benchmark::Bench& bench)
3540
auto elements = GenerateGCSTestElements();
3641

3742
uint64_t siphash_k0 = 0;
38-
bench.batch(elements.size()).unit("elem").run([&] {
43+
bench.run([&]{
3944
GCSFilter filter({siphash_k0, 0, BASIC_FILTER_P, BASIC_FILTER_M}, elements);
4045

4146
siphash_k0++;

0 commit comments

Comments
 (0)