Skip to content

Commit d35099e

Browse files
committed
bench: Add FeefracMultipication benchmark
1 parent 5fb70b5 commit d35099e

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed

src/Makefile.bench.include

+1
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ bench_bench_bitcoin_SOURCES = \
3232
bench/duplicate_inputs.cpp \
3333
bench/ellswift.cpp \
3434
bench/examples.cpp \
35+
bench/feefrac_mul.cpp \
3536
bench/gcs_filter.cpp \
3637
bench/hashpadding.cpp \
3738
bench/index_blockfilter.cpp \

src/bench/feefrac_mul.cpp

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
// Copyright (c) 2024-present The Bitcoin Core developers
2+
// Distributed under the MIT software license, see the accompanying
3+
// file COPYING or https://www.opensource.org/licenses/mit-license.php.
4+
5+
#include <bench/bench.h>
6+
#include <random.h>
7+
#include <util/feefrac.h>
8+
9+
#include <bit>
10+
#include <cstdint>
11+
12+
static void FeefracMultipication(benchmark::Bench& bench)
13+
{
14+
FastRandomContext rand(true);
15+
bench.run([&] {
16+
int64_t a64 = std::bit_cast<std::int64_t>(rand.rand64());
17+
int32_t b32 = std::bit_cast<std::int32_t>(rand.rand32());
18+
int64_t c64 = std::bit_cast<std::int64_t>(rand.rand64());
19+
int32_t d32 = std::bit_cast<std::int32_t>(rand.rand32());
20+
FeeRateCompare(FeeFrac(a64, b32), FeeFrac(c64, d32));
21+
});
22+
}
23+
24+
BENCHMARK(FeefracMultipication, benchmark::PriorityLevel::HIGH);

0 commit comments

Comments
 (0)