Skip to content

Commit 3208557

Browse files
committed
Merge bench_recover into bench
1 parent 855e18d commit 3208557

File tree

5 files changed

+16
-19
lines changed

5 files changed

+16
-19
lines changed

.gitignore

-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
bench
22
bench_ecmult
33
bench_schnorrsig
4-
bench_recover
54
bench_internal
65
tests
76
exhaustive_tests

ci/cirrus.sh

-4
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,6 @@ then
5151
$EXEC ./bench_internal
5252
$EXEC ./bench
5353
} >> bench.log 2>&1
54-
if [ "$RECOVERY" = "yes" ]
55-
then
56-
$EXEC ./bench_recover >> bench.log 2>&1
57-
fi
5854
if [ "$SCHNORRSIG" = "yes" ]
5955
then
6056
$EXEC ./bench_schnorrsig >> bench.log 2>&1

src/bench.c

+9
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,10 @@ static void bench_sign_run(void* arg, int iters) {
8080
# include "modules/ecdh/bench_impl.h"
8181
#endif
8282

83+
#ifdef ENABLE_MODULE_RECOVERY
84+
# include "modules/recovery/bench_impl.h"
85+
#endif
86+
8387
int main(void) {
8488
int i;
8589
secp256k1_pubkey pubkey;
@@ -121,5 +125,10 @@ int main(void) {
121125
run_ecdh_bench(iters);
122126
#endif
123127

128+
#ifdef ENABLE_MODULE_RECOVERY
129+
/* ECDSA recovery benchmarks */
130+
run_recovery_bench(iters);
131+
#endif
132+
124133
return 0;
125134
}

src/modules/recovery/Makefile.am.include

+1-5
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,4 @@ include_HEADERS += include/secp256k1_recovery.h
22
noinst_HEADERS += src/modules/recovery/main_impl.h
33
noinst_HEADERS += src/modules/recovery/tests_impl.h
44
noinst_HEADERS += src/modules/recovery/tests_exhaustive_impl.h
5-
if USE_BENCHMARK
6-
noinst_PROGRAMS += bench_recover
7-
bench_recover_SOURCES = src/bench_recover.c
8-
bench_recover_LDADD = libsecp256k1.la $(SECP_LIBS) $(COMMON_LIB)
9-
endif
5+
noinst_HEADERS += src/modules/recovery/bench_impl.h

src/bench_recover.c src/modules/recovery/bench_impl.h

+6-9
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44
* file COPYING or https://www.opensource.org/licenses/mit-license.php.*
55
***********************************************************************/
66

7-
#include "../include/secp256k1.h"
7+
#ifndef SECP256K1_MODULE_RECOVERY_BENCH_H
8+
#define SECP256K1_MODULE_RECOVERY_BENCH_H
9+
810
#include "../include/secp256k1_recovery.h"
9-
#include "util.h"
10-
#include "bench.h"
1111

1212
typedef struct {
1313
secp256k1_context *ctx;
@@ -48,17 +48,14 @@ void bench_recover_setup(void* arg) {
4848
}
4949
}
5050

51-
int main(void) {
51+
void run_recovery_bench(int iters) {
5252
bench_recover_data data;
5353

54-
int iters = get_iters(20000);
55-
5654
data.ctx = secp256k1_context_create(SECP256K1_CONTEXT_VERIFY);
5755

58-
print_output_table_header_row();
59-
6056
run_benchmark("ecdsa_recover", bench_recover, bench_recover_setup, NULL, &data, 10, iters);
6157

6258
secp256k1_context_destroy(data.ctx);
63-
return 0;
6459
}
60+
61+
#endif /* SECP256K1_MODULE_RECOVERY_BENCH_H */

0 commit comments

Comments
 (0)