mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-03-05 14:06:27 -05:00
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.
This commit is contained in:
parent
aee9a8140b
commit
e734228d85
1 changed files with 7 additions and 2 deletions
|
@ -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++;
|
||||
|
|
Loading…
Add table
Reference in a new issue