Skip to content

Commit 5072b2c

Browse files
committedJul 19, 2022
Bench tests for CPubKey<->EllSwift
1 parent edab3c7 commit 5072b2c

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
@@ -28,6 +28,7 @@ bench_bench_bitcoin_SOURCES = \
2828
bench/data.cpp \
2929
bench/data.h \
3030
bench/duplicate_inputs.cpp \
31+
bench/ellswift.cpp \
3132
bench/examples.cpp \
3233
bench/gcs_filter.cpp \
3334
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 <pubkey.h>
9+
#include <random.h>
10+
11+
#include <array>
12+
13+
static void EllSwiftEncode(benchmark::Bench& bench)
14+
{
15+
ECC_Start();
16+
std::array<uint8_t, 32> rnd32;
17+
GetRandBytes(rnd32);
18+
19+
CKey key;
20+
key.MakeNewKey(false);
21+
auto pubkey = key.GetPubKey();
22+
23+
bench.batch(1).unit("pubkey").run([&] {
24+
pubkey.EllSwiftEncode(rnd32);
25+
});
26+
}
27+
28+
BENCHMARK(EllSwiftEncode);

0 commit comments

Comments
 (0)
Please sign in to comment.