test: split monolithic ellswift test into independent cases #1788

pull furszy wants to merge 1 commits into bitcoin-core:master from furszy:2025_tests_split_ellswift changing 1 files +65 −33
  1. furszy commented at 5:01 pm on December 14, 2025: member

    No behavior changes.

    Refactors the previously monolithic ElligatorSwift test into isolated, independent test cases. Doing so allows the test suite to execute these cases in parallel rather than sequentially.

    Overall, I’m seeing 35-40% tests time reduction locally.

    This is quite useful for Debug builds with no optimizations, which are noticeably slow.

     Local Debug-build Results (7 jobs):

    • master: 138.0 seconds.
    • this PR: 89.3 seconds. (~1.55× speedup, ~35% reduction)

     Local Release-build Results (7 jobs):

    • master: 9.5 seconds.
    • this PR: 5.9 seconds. (~1.61× speedup, ~38% reduction)

     rp5 Release-build results (5 jobs):

    • master: 39 seconds.
    • this PR: 24 seconds. (~1.62× speedup, ~38% reduction)
  2. in src/modules/ellswift/tests_impl.h:320 in f12e2e04d2
    314@@ -293,6 +315,10 @@ void run_ellswift_tests(void) {
    315         /* Compare. */
    316         CHECK(fe_equal(&res.x, &share_x));
    317     }
    318+}
    319+
    320+void test_ellswift_xdh_correctness(void) {
    


    real-or-random commented at 7:23 am on December 15, 2025:

    consistency nit if you touch again:

    0void ellswift_xdh_correctness_tests(void) {
    

    furszy commented at 2:35 pm on December 15, 2025:
    upps, fixed. Thanks!
  3. real-or-random approved
  4. real-or-random commented at 7:24 am on December 15, 2025: contributor
    utACK f12e2e04d2b88a0eec3a676be0f2443d2b082c4f
  5. real-or-random added the label assurance on Dec 15, 2025
  6. real-or-random added the label tweak/refactor on Dec 15, 2025
  7. hebasto approved
  8. hebasto commented at 12:42 pm on December 15, 2025: member

    ACK f12e2e04d2b88a0eec3a676be0f2443d2b082c4f, I have reviewed the code and it looks OK. Tested on Ubuntu 25.10.

    Happy to re-ACK once #1788 (review) is addressed.

  9. hebasto commented at 12:48 pm on December 15, 2025: member

    Here is log on my machine:

     0$ ./build/bin/tests -j=16 -t=ellswift -log=1
     1iterations = 16
     2jobs = 16. Parallel execution.
     3random seed = 3ccb907b6b59142af5e562fdf21e2a62
     4Running ellswift_encoding_test_vectors_tests..
     5Running ellswift_xdh_test_vectors_tests..
     6Running ellswift_decoding_test_vectors_tests..
     7Running ellswift_compute_shared_secret_tests..
     8Running ellswift_encode_decode_roundtrip_tests..
     9Running test_ellswift_xdh_correctness..
    10Running ellswift_hash_init_tests..
    11Running ellswift_create_tests..
    12Test ellswift_hash_init_tests PASSED (0.000 sec)
    13Test ellswift_xdh_test_vectors_tests PASSED (0.002 sec)
    14Test ellswift_decoding_test_vectors_tests PASSED (0.002 sec)
    15Test ellswift_encoding_test_vectors_tests PASSED (0.012 sec)
    16Test ellswift_create_tests PASSED (1.424 sec)
    17Test ellswift_compute_shared_secret_tests PASSED (2.448 sec)
    18Test ellswift_encode_decode_roundtrip_tests PASSED (2.702 sec)
    19Test test_ellswift_xdh_correctness PASSED (4.505 sec)
    20Total execution time: 4.509 seconds
    

    Could we re-arrange test cases to run the longest ones first?

  10. test: split monolithic ellswift test into independent cases
    No behavior changes.
    
    Refactors the previously monolithic ElligatorSwift test into isolated,
    independent test cases. Doing so allows the test suite to execute
    these cases in parallel rather than sequentially.
    
    Overall, seen 35-40% tests time reduction locally.
    
    This is quite useful for the Debug build with no optimizations,
    which is noticeably slow.
    
    #### Local Debug-build Results (7 jobs):
    
    - master: 138.0 seconds.
    - this PR: 89.3 seconds.
       (~1.55× speedup, ~35% reduction)
    
    #### Local Release-build Results (7 jobs):
    
    - master: 9.5 seconds.
    - this PR: 5.9 seconds.
       (~1.61× speedup, ~38% reduction)
    d822b29021
  11. furszy force-pushed on Dec 15, 2025
  12. hebasto approved
  13. hebasto commented at 2:30 pm on December 15, 2025: member
    re-ACK d822b2902106829bae1455cabec6bfca9a265a77.
  14. furszy commented at 2:34 pm on December 15, 2025: member

    Could we re-arrange test cases to run the longest ones first?

    We could do it, but it wouldn’t make much of a difference atm. The ellswift module sits deep in the test registry (see). We should move the module up too. Which is really a small change.

    Yet, it might be worth considering adding cost score functionality to the internal framework, so test execution can be automatically arranged based on it.

  15. theStack approved
  16. theStack commented at 5:47 pm on December 15, 2025: contributor

    ACK d822b2902106829bae1455cabec6bfca9a265a77

    Nice!

     0$ ./build/bin/tests -t=ellswift -log=1 -j=8
     1iterations = 16
     2jobs = 8. Parallel execution.
     3random seed = 81780fc09f616932c95e8182acab17d9
     4Running ellswift_encoding_test_vectors_tests..
     5Running ellswift_decoding_test_vectors_tests..
     6Running ellswift_xdh_test_vectors_tests..
     7Running ellswift_create_tests..
     8Running ellswift_compute_shared_secret_tests..
     9Running ellswift_encode_decode_roundtrip_tests..
    10Running ellswift_xdh_correctness_tests..
    11Running ellswift_hash_init_tests..
    12Test ellswift_hash_init_tests PASSED (0.000 sec)
    13Test ellswift_xdh_test_vectors_tests PASSED (0.001 sec)
    14Test ellswift_decoding_test_vectors_tests PASSED (0.002 sec)
    15Test ellswift_encoding_test_vectors_tests PASSED (0.012 sec)
    16Test ellswift_create_tests PASSED (1.157 sec)
    17Test ellswift_compute_shared_secret_tests PASSED (2.049 sec)
    18Test ellswift_encode_decode_roundtrip_tests PASSED (2.156 sec)
    19Test ellswift_xdh_correctness_tests PASSED (3.674 sec)
    20Total execution time: 3.675 seconds
    
  17. real-or-random merged this on Dec 15, 2025
  18. real-or-random closed this on Dec 15, 2025

  19. furszy deleted the branch on Dec 15, 2025

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-12-16 07:15 UTC

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