Add GCSFilterDecodeSkipCheck benchmark

This benchmark allows us to compare the differences between doing the
sanity check for corruption via GolombRiceDecode() vs checking the hash
of the encoded block filter.
This commit is contained in:
Patrick Strateman 2020-06-15 19:41:18 -04:00 committed by Calvin Kim
parent 299023c1d9
commit aee9a8140b

View file

@ -54,6 +54,18 @@ static void GCSFilterDecode(benchmark::Bench& bench)
});
}
static void GCSFilterDecodeSkipCheck(benchmark::Bench& bench)
{
auto elements = GenerateGCSTestElements();
GCSFilter filter({0, 0, BASIC_FILTER_P, BASIC_FILTER_M}, elements);
auto encoded = filter.GetEncoded();
bench.run([&] {
GCSFilter filter({0, 0, BASIC_FILTER_P, BASIC_FILTER_M}, encoded, /*skip_decode_check=*/true);
});
}
static void GCSFilterMatch(benchmark::Bench& bench)
{
auto elements = GenerateGCSTestElements();
@ -67,4 +79,5 @@ static void GCSFilterMatch(benchmark::Bench& bench)
BENCHMARK(GCSBlockFilterGetHash);
BENCHMARK(GCSFilterConstruct);
BENCHMARK(GCSFilterDecode);
BENCHMARK(GCSFilterDecodeSkipCheck);
BENCHMARK(GCSFilterMatch);