doc/bench: added help text for SECP256K1_BENCH_ITERS env var for bench_ecmult #1793

pull kevkevinpal wants to merge 1 commits into bitcoin-core:master from kevkevinpal:addBenchItersEnvVarHelp changing 1 files +10 −4
  1. kevkevinpal commented at 3:08 am on December 30, 2025: contributor

    Description

    I noticed that in both bench and bench_internal there was a help text mentioning to the users that you could use SECP256K1_BENCH_ITERS to customize the amount of iterations for each benchmark, but bench_ecmult did not have this text so I added it in.

    There is a caveat that if SECP256K1_BENCH_ITERS is less than 3, then run_ecmult_multi_bench will not run. Should I add that to the help text?


    Before

     0$ ./build/bin/bench_ecmult -h
     1Benchmark EC multiplication algorithms
     2
     3Usage: ./build/bin/bench_ecmult <help|pippenger_wnaf|strauss_wnaf|simple>
     4The output shows the number of multiplied and summed points right after the
     5function name. The letter 'g' indicates that one of the points is the generator.
     6The benchmarks are divided by the number of points.
     7
     8default (ecmult_multi): picks pippenger_wnaf or strauss_wnaf depending on the
     9                        batch size
    10pippenger_wnaf:         for all batch sizes
    11strauss_wnaf:           for all batch sizes
    12simple:                 multiply and sum each point individually
    

    After

     0$ ./build/bin/bench_ecmult -h
     1Benchmark EC multiplication algorithms
     2
     3The default number of iterations for each benchmark is 10000. This can be
     4customized using the SECP256K1_BENCH_ITERS environment variable.
     5
     6Usage: ./build/bin/bench_ecmult <help|pippenger_wnaf|strauss_wnaf|simple>
     7The output shows the number of multiplied and summed points right after the
     8function name. The letter 'g' indicates that one of the points is the generator.
     9The benchmarks are divided by the number of points.
    10
    11default (ecmult_multi): picks pippenger_wnaf or strauss_wnaf depending on the
    12                        batch size
    13pippenger_wnaf:         for all batch sizes
    14strauss_wnaf:           for all batch sizes
    15simple:                 multiply and sum each point individually
    
  2. real-or-random added the label user-documentation on Jan 6, 2026
  3. real-or-random added the label tweak/refactor on Jan 6, 2026
  4. real-or-random commented at 8:30 am on January 6, 2026: contributor

    There is a caveat that if SECP256K1_BENCH_ITERS is less than 3, then run_ecmult_multi_bench will not run. Should I add that to the help text?

    I don’t see why this is. Can you explain?

    If that’s the case, we could just check this condition and bail out (instead of documenting it).

  5. kevkevinpal commented at 6:30 pm on January 6, 2026: contributor

    I don’t see why this is. Can you explain?

    Yea if you take a look at this block of code if iters is less than 3 we don’t run run_ecmult_multi_bench

    If that’s the case, we could just check this condition and bail out (instead of documenting it).

    We already bail out in this block, I was just suggesting if we add documentation in the help text for SECP256K1_BENCH_ITERS we can note that it will bail out. But we don’t need to if that is too verbose.

  6. real-or-random commented at 6:57 am on January 7, 2026: contributor
    Oh yes, I missed that if. What about adding an else block that prints a message like “Skipping some benchmarks due to SECP256K1_BENCH_ITERS <= 2”?
  7. kevkevinpal force-pushed on Jan 7, 2026
  8. kevkevinpal commented at 3:36 pm on January 7, 2026: contributor

    Oh yes, I missed that if. What about adding an else block that prints a message like “Skipping some benchmarks due to SECP256K1_BENCH_ITERS <= 2”?

    Sounds good I updated it in 8f331c9

  9. kevkevinpal commented at 3:39 pm on January 7, 2026: contributor

    This might be good for a follow-up but I noticed that if we put any value for SECP256K1_BENCH_ITERS not greater than 0

    It will print Floating point exception (core dumped)

    A simple check would fix that

    Example

     0(addBenchItersEnvVarHelp) secp256k1 $ SECP256K1_BENCH_ITERS=0 ./build/bin/bench
     1Benchmark                     ,    Min(us)    ,    Avg(us)    ,    Max(us)
     2
     3Floating point exception (core dumped)
     4(addBenchItersEnvVarHelp) secp256k1 $ SECP256K1_BENCH_ITERS=abc ./build/bin/bench
     5Benchmark                     ,    Min(us)    ,    Avg(us)    ,    Max(us)
     6
     7Floating point exception (core dumped)
     8(addBenchItersEnvVarHelp) secp256k1 $ SECP256K1_BENCH_ITERS= ./build/bin/bench
     9Benchmark                     ,    Min(us)    ,    Avg(us)    ,    Max(us)
    10
    11Floating point exception (core dumped)
    
  10. doc/bench: added help text for SECP256K1_BENCH_ITERS env var for bench_ecmult
    In addition a print message saying some tests were skipped was added
    bd5ced1fe1
  11. kevkevinpal force-pushed on Jan 7, 2026

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin-core/secp256k1. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-01-07 22:15 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me