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
  3. stratospher commented at 3:45 PM on September 18, 2025: contributor

    ACK dfe284e. not sure whether the alternative is preferred though.

  4. real-or-random approved
  5. real-or-random commented at 4:02 PM on September 19, 2025: contributor

    utACK dfe284ed2d24ab44705ca5ecd8f3f7e1b8e4c278

  6. real-or-random added the label tweak/refactor on Sep 19, 2025
  7. sipa commented at 9:27 PM on September 19, 2025: contributor

    utACK dfe284ed2d24ab44705ca5ecd8f3f7e1b8e4c278

  8. furszy commented at 9:47 PM on September 21, 2025: member

    ACK dfe284ed2d24ab44705ca5ecd8f3f7e1b8e4c278

    If it wouldn't be for the initial VERIFY_CHECK, the context could be null as it is not used internally.

  9. real-or-random merged this on Sep 22, 2025
  10. real-or-random closed this on Sep 22, 2025

  11. theStack deleted the branch on Sep 22, 2025
  12. fanquake referenced this in commit 42c7d35d3a on Oct 14, 2025
  13. fanquake referenced this in commit 3cbf7cb3e6 on Oct 15, 2025
  14. Sjors referenced this in commit d5660d3a13 on Feb 16, 2026
  15. github-actions[bot] referenced this in commit c3f80fff5f on Mar 1, 2026
  16. github-actions[bot] referenced this in commit 4aeff8400e on Mar 1, 2026
  17. github-actions[bot] referenced this in commit 5f15eb0c55 on Mar 1, 2026
  18. 0x000000000019d6689c085ae165831e934ff76 referenced this in commit d54574beca on Mar 2, 2026
  19. csjones referenced this in commit fb3e16af04 on Mar 2, 2026
  20. real-or-random referenced this in commit 56751a4cf0 on Mar 2, 2026
  21. 0x000000000019d6689c085ae165831e934ff76 referenced this in commit 924c279a64 on Mar 2, 2026
  22. csjones referenced this in commit bf90997db1 on Mar 2, 2026
  23. vmta referenced this in commit 1ddc2f947f on Apr 26, 2026
  24. vmta referenced this in commit 56c40fe100 on Apr 27, 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-05-19 06:52 UTC