Skip to content

Commit 506a267

Browse files
committed
Bench tests for CKey->EllSwift
1 parent 18895d3 commit 506a267

File tree

2 files changed

+29
-0
lines changed

2 files changed

+29
-0
lines changed

src/Makefile.bench.include

+1
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ bench_bench_bitcoin_SOURCES = \
2929
bench/data.h \
3030
bench/descriptors.cpp \
3131
bench/duplicate_inputs.cpp \
32+
bench/ellswift.cpp \
3233
bench/examples.cpp \
3334
bench/gcs_filter.cpp \
3435
bench/hashpadding.cpp \

src/bench/ellswift.cpp

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
// Copyright (c) 2016-2020 The Bitcoin Core developers
2+
// Distributed under the MIT software license, see the accompanying
3+
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
4+
5+
#include <bench/bench.h>
6+
7+
#include <key.h>
8+
#include <random.h>
9+
10+
#include <array>
11+
#include <cstddef>
12+
13+
static void EllSwiftEncode(benchmark::Bench& bench)
14+
{
15+
ECC_Start();
16+
17+
CKey key;
18+
key.MakeNewKey(true);
19+
20+
bench.batch(1).unit("pubkey").run([&] {
21+
std::array<std::byte, 32> rnd32;
22+
GetRandBytes({reinterpret_cast<unsigned char*>(rnd32.data()), 32});
23+
key.EllSwiftEncode(rnd32);
24+
});
25+
ECC_Stop();
26+
}
27+
28+
BENCHMARK(EllSwiftEncode, benchmark::PriorityLevel::HIGH);

0 commit comments

Comments
 (0)