Skip to content

Commit 9f56bdf

Browse files
committed
Merge bench_schnorrsig into bench
1 parent 3208557 commit 9f56bdf

File tree

5 files changed

+16
-21
lines changed

5 files changed

+16
-21
lines changed

.gitignore

-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
bench
22
bench_ecmult
3-
bench_schnorrsig
43
bench_internal
54
tests
65
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 [ "$SCHNORRSIG" = "yes" ]
55-
then
56-
$EXEC ./bench_schnorrsig >> bench.log 2>&1
57-
fi
5854
fi
5955
if [ "$CTIMETEST" = "yes" ]
6056
then

src/bench.c

+9
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,10 @@ static void bench_sign_run(void* arg, int iters) {
8484
# include "modules/recovery/bench_impl.h"
8585
#endif
8686

87+
#ifdef ENABLE_MODULE_SCHNORRSIG
88+
# include "modules/schnorrsig/bench_impl.h"
89+
#endif
90+
8791
int main(void) {
8892
int i;
8993
secp256k1_pubkey pubkey;
@@ -130,5 +134,10 @@ int main(void) {
130134
run_recovery_bench(iters);
131135
#endif
132136

137+
#ifdef ENABLE_MODULE_SCHNORRSIG
138+
/* Schnorr signature benchmarks */
139+
run_schnorrsig_bench(iters);
140+
#endif
141+
133142
return 0;
134143
}

src/modules/schnorrsig/Makefile.am.include

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

src/bench_schnorrsig.c src/modules/schnorrsig/bench_impl.h

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

7-
#include <string.h>
8-
#include <stdlib.h>
7+
#ifndef SECP256K1_MODULE_SCHNORRSIG_BENCH_H
8+
#define SECP256K1_MODULE_SCHNORRSIG_BENCH_H
99

10-
11-
#include "../include/secp256k1.h"
12-
#include "../include/secp256k1_schnorrsig.h"
13-
#include "util.h"
14-
#include "bench.h"
10+
#include "../../../include/secp256k1_schnorrsig.h"
1511

1612
#define MSGLEN 32
1713

@@ -49,10 +45,9 @@ void bench_schnorrsig_verify(void* arg, int iters) {
4945
}
5046
}
5147

52-
int main(void) {
48+
void run_schnorrsig_bench(int iters) {
5349
int i;
5450
bench_schnorrsig_data data;
55-
int iters = get_iters(10000);
5651

5752
data.ctx = secp256k1_context_create(SECP256K1_CONTEXT_VERIFY | SECP256K1_CONTEXT_SIGN);
5853
data.keypairs = (const secp256k1_keypair **)malloc(iters * sizeof(secp256k1_keypair *));
@@ -86,7 +81,6 @@ int main(void) {
8681
CHECK(secp256k1_xonly_pubkey_serialize(data.ctx, pk_char, &pk) == 1);
8782
}
8883

89-
print_output_table_header_row();
9084
run_benchmark("schnorrsig_sign", bench_schnorrsig_sign, NULL, NULL, (void *) &data, 10, iters);
9185
run_benchmark("schnorrsig_verify", bench_schnorrsig_verify, NULL, NULL, (void *) &data, 10, iters);
9286

@@ -102,5 +96,6 @@ int main(void) {
10296
free(data.sigs);
10397

10498
secp256k1_context_destroy(data.ctx);
105-
return 0;
10699
}
100+
101+
#endif

0 commit comments

Comments
 (0)