forked from bitcoin/bitcoin
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
bench: Add
FeefracMultipication
benchmark
- Loading branch information
Showing
2 changed files
with
27 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
// Copyright (c) 2024-present The Bitcoin Core developers | ||
// Distributed under the MIT software license, see the accompanying | ||
// file COPYING or https://www.opensource.org/licenses/mit-license.php. | ||
|
||
#include <bench/bench.h> | ||
#include <random.h> | ||
#include <util/feefrac.h> | ||
|
||
#include <bit> | ||
#include <cstdint> | ||
|
||
static void FeefracMultipication(benchmark::Bench& bench) | ||
{ | ||
FastRandomContext rnd; | ||
uint64_t a64 = rnd.rand64(); | ||
uint32_t b32 = rnd.rand32(); | ||
uint64_t c64 = rnd.rand64(); | ||
uint32_t d32 = rnd.rand32(); | ||
bench.minEpochIterations(10000000).run([&] { | ||
FeeRateCompare( | ||
FeeFrac(std::bit_cast<std::int64_t>(a64++), std::bit_cast<std::int32_t>(b32++)), | ||
FeeFrac(std::bit_cast<std::int64_t>(c64++), std::bit_cast<std::int32_t>(d32++))); | ||
}); | ||
} | ||
|
||
BENCHMARK(FeefracMultipication, benchmark::PriorityLevel::HIGH); |