1 // Copyright (c) 2016 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.
14 static void Base58Encode(benchmark::State
& state
)
16 unsigned char buff
[32] = {
17 17, 79, 8, 99, 150, 189, 208, 162, 22, 23, 203, 163, 36, 58, 147,
18 227, 139, 2, 215, 100, 91, 38, 11, 141, 253, 40, 117, 21, 16, 90,
21 unsigned char* b
= buff
;
22 while (state
.KeepRunning()) {
23 EncodeBase58(b
, b
+ 32);
28 static void Base58CheckEncode(benchmark::State
& state
)
30 unsigned char buff
[32] = {
31 17, 79, 8, 99, 150, 189, 208, 162, 22, 23, 203, 163, 36, 58, 147,
32 227, 139, 2, 215, 100, 91, 38, 11, 141, 253, 40, 117, 21, 16, 90,
35 unsigned char* b
= buff
;
36 std::vector
<unsigned char> vch
;
37 vch
.assign(b
, b
+ 32);
38 while (state
.KeepRunning()) {
39 EncodeBase58Check(vch
);
44 static void Base58Decode(benchmark::State
& state
)
46 const char* addr
= "17VZNX1SN5NtKa8UQFxwQbFeFc3iqRYhem";
47 std::vector
<unsigned char> vch
;
48 while (state
.KeepRunning()) {
49 DecodeBase58(addr
, vch
);
54 BENCHMARK(Base58Encode
);
55 BENCHMARK(Base58CheckEncode
);
56 BENCHMARK(Base58Decode
);