Skip to content

Commit 4721e07

Browse files
committed
Merge #1793: doc/bench: added help text for SECP256K1_BENCH_ITERS env var for bench_ecmult
bd5ced1 doc/bench: added help text for SECP256K1_BENCH_ITERS env var for bench_ecmult (kevkevinpal) Pull request description: ACKs for top commit: real-or-random: utACK bd5ced1 hebasto: ACK bd5ced1, I have reviewed the code and it looks OK. Tested on Ubuntu 25.10. jonasnick: ACK bd5ced1 Tree-SHA512: 7cfc1a8915717bdfe2901f20f578e23368ece9937a40f36805a0a5b741f97a0502a085c973f6912b96c2bca921ef1654908cfe2c90c0601a7ffa92de4415dc62
2 parents 2d9137c + bd5ced1 commit 4721e07

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

src/bench_ecmult.c

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,12 @@
1919

2020
#define POINTS 32768
2121

22-
static void help(char **argv) {
22+
static void help(char **argv, int default_iters) {
2323
printf("Benchmark EC multiplication algorithms\n");
2424
printf("\n");
25+
printf("The default number of iterations for each benchmark is %d. This can be\n", default_iters);
26+
printf("customized using the SECP256K1_BENCH_ITERS environment variable.\n");
27+
printf("\n");
2528
printf("Usage: %s <help|pippenger_wnaf|strauss_wnaf|simple>\n", argv[0]);
2629
printf("The output shows the number of multiplied and summed points right after the\n");
2730
printf("function name. The letter 'g' indicates that one of the points is the generator.\n");
@@ -308,15 +311,16 @@ int main(int argc, char **argv) {
308311
int i, p;
309312
size_t scratch_size;
310313

311-
int iters = get_iters(10000);
314+
int default_iters = 10000;
315+
int iters = get_iters(default_iters);
312316

313317
data.ecmult_multi = secp256k1_ecmult_multi_var;
314318

315319
if (argc > 1) {
316320
if(have_flag(argc, argv, "-h")
317321
|| have_flag(argc, argv, "--help")
318322
|| have_flag(argc, argv, "help")) {
319-
help(argv);
323+
help(argv, default_iters);
320324
return EXIT_SUCCESS;
321325
} else if(have_flag(argc, argv, "pippenger_wnaf")) {
322326
printf("Using pippenger_wnaf:\n");
@@ -328,7 +332,7 @@ int main(int argc, char **argv) {
328332
printf("Using simple algorithm:\n");
329333
} else {
330334
fprintf(stderr, "%s: unrecognized argument '%s'.\n\n", argv[0], argv[1]);
331-
help(argv);
335+
help(argv, default_iters);
332336
return EXIT_FAILURE;
333337
}
334338
}
@@ -381,6 +385,8 @@ int main(int argc, char **argv) {
381385
run_ecmult_multi_bench(&data, i << p, 1, iters);
382386
}
383387
}
388+
} else {
389+
printf("Skipping some benchmarks due to SECP256K1_BENCH_ITERS <= 2\n");
384390
}
385391

386392
if (data.scratch != NULL) {

0 commit comments

Comments
 (0)