mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-05-12 23:13:25 +02:00
bench: Utilitze setup() in WalletBalance for marking caches dirty
WalletBalance benchmarks the balance computation function and should exclude the setup step of (optionally) marking caches as dirty. Instead, that is moved into setup().
This commit is contained in:
@@ -53,11 +53,14 @@ static void WalletBalance(benchmark::Bench& bench, const bool set_dirty, const b
|
||||
|
||||
auto bal = GetBalance(wallet); // Cache
|
||||
|
||||
bench.run([&] {
|
||||
if (set_dirty) wallet.MarkDirty();
|
||||
bal = GetBalance(wallet);
|
||||
if (add_mine) assert(bal.m_mine_trusted > 0);
|
||||
});
|
||||
bench.setup([&] {
|
||||
if (set_dirty) wallet.MarkDirty();
|
||||
})
|
||||
.run([&] {
|
||||
bal = GetBalance(wallet);
|
||||
ankerl::nanobench::doNotOptimizeAway(bal);
|
||||
assert(add_mine == (bal.m_mine_trusted > 0));
|
||||
});
|
||||
}
|
||||
|
||||
static void WalletBalanceDirty(benchmark::Bench& bench) { WalletBalance(bench, /*set_dirty=*/true, /*add_mine=*/true); }
|
||||
|
||||
Reference in New Issue
Block a user