aboutsummaryrefslogtreecommitdiff
path: root/src/bench
diff options
context:
space:
mode:
authorPatrick Strateman <patrick.strateman@gmail.com>2020-06-15 19:41:18 -0400
committerCalvin Kim <calvin@kcalvinalvin.info>2022-05-22 14:00:41 +0900
commitaee9a8140b3a58b744766f9e89572f1d953a808b (patch)
tree6c81ed8e333c4fc17e11ab7d4cde8a8fa668a833 /src/bench
parent299023c1d9962628d158fac0306f8531506a0123 (diff)
downloadbitcoin-aee9a8140b3a58b744766f9e89572f1d953a808b.tar.xz
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.
Diffstat (limited to 'src/bench')
-rw-r--r--src/bench/gcs_filter.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/bench/gcs_filter.cpp b/src/bench/gcs_filter.cpp
index c96e9b7f31..0b43652453 100644
--- a/src/bench/gcs_filter.cpp
+++ b/src/bench/gcs_filter.cpp
@@ -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);