bench: improve context creation in ECDH benchmark #1748

pull theStack wants to merge 1 commits into bitcoin-core:master from theStack:context_static-for-ecdh-benchmark changing 1 files +2 −5
  1. theStack commented at 9:34 pm on September 16, 2025: contributor

    Calling secp256k1_context_create with SECP256K1_FLAGS_TYPE_CONTEXT seems to be confusing and not strictly API-compliant, as the only allowed (non-deprecated) value is SECP256K1_CONTEXT_NONE, even if the former happens to map to the latter currently.

    Fix this by not dynamically creating a context in the first place and switch to using the static context, as it is sufficient for this benchmark and presumably matches what the “no capabilities” comment intended back then.

    Alternatives are:

    • keep the signing context and only fix the name, i.e. s/_FLAGS_TYPE_CONTEXT/_CONTEXT_NONE/
    • use secp256k1_context_static everywhere directly and get rid of the ctx field in the bench_ecdh_data struct (less flexible for future changes, deviates from other bench structures)

    Found while reviewing #1698, see #1698 (review).

  2. bench: improve context creation in ECDH benchmark
    Calling `secp256k1_context_create` with `SECP256K1_FLAGS_TYPE_CONTEXT`
    seems to be not strictly API-compliant, as the only allowed
    (non-deprecated) value is `SECP256K1_CONTEXT_NONE`, even if the
    former happens to map to the latter currently.
    
    Fix this by not dynamically creating a context in the first place and
    switch to using the static context, as it is sufficient for this
    benchmark and presumably matches what the "no capabilities" comment
    intended back then.
    dfe284ed2d


theStack


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: 2025-09-18 02:15 UTC

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