Skip to content

Commit 6dff621

Browse files
committed
bench: put addrman check ratio in a variable
So that it is easy to modify through the file `bench/addrman.cpp`.
1 parent 6f7c756 commit 6dff621

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

src/bench/addrman.cpp

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@
1616
static constexpr size_t NUM_SOURCES = 64;
1717
static constexpr size_t NUM_ADDRESSES_PER_SOURCE = 256;
1818

19+
static const std::vector<bool> EMPTY_ASMAP;
20+
static constexpr uint32_t ADDRMAN_CONSISTENCY_CHECK_RATIO{0};
21+
1922
static std::vector<CAddress> g_sources;
2023
static std::vector<std::vector<CAddress>> g_addresses;
2124

@@ -74,14 +77,14 @@ static void AddrManAdd(benchmark::Bench& bench)
7477
CreateAddresses();
7578

7679
bench.run([&] {
77-
AddrMan addrman{/* asmap */ std::vector<bool>(), /* deterministic */ false, /* consistency_check_ratio */ 0};
80+
AddrMan addrman{EMPTY_ASMAP, /*deterministic=*/false, ADDRMAN_CONSISTENCY_CHECK_RATIO};
7881
AddAddressesToAddrMan(addrman);
7982
});
8083
}
8184

8285
static void AddrManSelect(benchmark::Bench& bench)
8386
{
84-
AddrMan addrman(/* asmap */ std::vector<bool>(), /* deterministic */ false, /* consistency_check_ratio */ 0);
87+
AddrMan addrman{EMPTY_ASMAP, /*deterministic=*/false, ADDRMAN_CONSISTENCY_CHECK_RATIO};
8588

8689
FillAddrMan(addrman);
8790

@@ -93,7 +96,7 @@ static void AddrManSelect(benchmark::Bench& bench)
9396

9497
static void AddrManGetAddr(benchmark::Bench& bench)
9598
{
96-
AddrMan addrman(/* asmap */ std::vector<bool>(), /* deterministic */ false, /* consistency_check_ratio */ 0);
99+
AddrMan addrman{EMPTY_ASMAP, /*deterministic=*/false, ADDRMAN_CONSISTENCY_CHECK_RATIO};
97100

98101
FillAddrMan(addrman);
99102

@@ -122,7 +125,7 @@ static void AddrManAddThenGood(benchmark::Bench& bench)
122125
//
123126
// This has some overhead (exactly the result of AddrManAdd benchmark), but that overhead is constant so improvements in
124127
// AddrMan::Good() will still be noticeable.
125-
AddrMan addrman(/* asmap */ std::vector<bool>(), /* deterministic */ false, /* consistency_check_ratio */ 0);
128+
AddrMan addrman{EMPTY_ASMAP, /*deterministic=*/false, ADDRMAN_CONSISTENCY_CHECK_RATIO};
126129
AddAddressesToAddrMan(addrman);
127130

128131
markSomeAsGood(addrman);

0 commit comments

Comments
 (0)