Merge bench_schnorrsig into bench

This commit is contained in:
Pieter Wuille 2021-10-17 14:02:10 -04:00
parent 3208557ae1
commit 9f56bdf5b9
5 changed files with 16 additions and 21 deletions

1
.gitignore vendored
View File

@ -1,6 +1,5 @@
bench
bench_ecmult
bench_schnorrsig
bench_internal
tests
exhaustive_tests

View File

@ -51,10 +51,6 @@ then
$EXEC ./bench_internal
$EXEC ./bench
} >> bench.log 2>&1
if [ "$SCHNORRSIG" = "yes" ]
then
$EXEC ./bench_schnorrsig >> bench.log 2>&1
fi
fi
if [ "$CTIMETEST" = "yes" ]
then

View File

@ -84,6 +84,10 @@ static void bench_sign_run(void* arg, int iters) {
# include "modules/recovery/bench_impl.h"
#endif
#ifdef ENABLE_MODULE_SCHNORRSIG
# include "modules/schnorrsig/bench_impl.h"
#endif
int main(void) {
int i;
secp256k1_pubkey pubkey;
@ -130,5 +134,10 @@ int main(void) {
run_recovery_bench(iters);
#endif
#ifdef ENABLE_MODULE_SCHNORRSIG
/* Schnorr signature benchmarks */
run_schnorrsig_bench(iters);
#endif
return 0;
}

View File

@ -2,8 +2,4 @@ include_HEADERS += include/secp256k1_schnorrsig.h
noinst_HEADERS += src/modules/schnorrsig/main_impl.h
noinst_HEADERS += src/modules/schnorrsig/tests_impl.h
noinst_HEADERS += src/modules/schnorrsig/tests_exhaustive_impl.h
if USE_BENCHMARK
noinst_PROGRAMS += bench_schnorrsig
bench_schnorrsig_SOURCES = src/bench_schnorrsig.c
bench_schnorrsig_LDADD = libsecp256k1.la $(SECP_LIBS) $(COMMON_LIB)
endif
noinst_HEADERS += src/modules/schnorrsig/bench_impl.h

View File

@ -4,14 +4,10 @@
* file COPYING or https://www.opensource.org/licenses/mit-license.php.*
***********************************************************************/
#include <string.h>
#include <stdlib.h>
#ifndef SECP256K1_MODULE_SCHNORRSIG_BENCH_H
#define SECP256K1_MODULE_SCHNORRSIG_BENCH_H
#include "../include/secp256k1.h"
#include "../include/secp256k1_schnorrsig.h"
#include "util.h"
#include "bench.h"
#include "../../../include/secp256k1_schnorrsig.h"
#define MSGLEN 32
@ -49,10 +45,9 @@ void bench_schnorrsig_verify(void* arg, int iters) {
}
}
int main(void) {
void run_schnorrsig_bench(int iters) {
int i;
bench_schnorrsig_data data;
int iters = get_iters(10000);
data.ctx = secp256k1_context_create(SECP256K1_CONTEXT_VERIFY | SECP256K1_CONTEXT_SIGN);
data.keypairs = (const secp256k1_keypair **)malloc(iters * sizeof(secp256k1_keypair *));
@ -86,7 +81,6 @@ int main(void) {
CHECK(secp256k1_xonly_pubkey_serialize(data.ctx, pk_char, &pk) == 1);
}
print_output_table_header_row();
run_benchmark("schnorrsig_sign", bench_schnorrsig_sign, NULL, NULL, (void *) &data, 10, iters);
run_benchmark("schnorrsig_verify", bench_schnorrsig_verify, NULL, NULL, (void *) &data, 10, iters);
@ -102,5 +96,6 @@ int main(void) {
free(data.sigs);
secp256k1_context_destroy(data.ctx);
return 0;
}
#endif