Skip to content

Commit

Permalink
multiprecision: add inverse benchmarks
Browse files Browse the repository at this point in the history
  • Loading branch information
ioxid committed Dec 17, 2024
1 parent 7a0839f commit f72c4cb
Show file tree
Hide file tree
Showing 2 changed files with 161 additions and 139 deletions.
18 changes: 18 additions & 0 deletions crypto3/benchmarks/multiprecision/big_int.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -290,3 +290,21 @@ BOOST_AUTO_TEST_CASE(big_mod_mul_perf_test) {
}

BOOST_AUTO_TEST_SUITE_END()

BOOST_AUTO_TEST_SUITE(compile_time_inverse_tests)

BOOST_AUTO_TEST_CASE(inverse_extended_euclidean_algorithm_test) {
auto x_modular = x_mod_ct_odd;

nil::crypto3::bench::run_benchmark<>(
"[odd modulus][compile time] inverse_extended_euclidean_algorithm_test", [&]() {
x_modular = inverse_extended_euclidean_algorithm(x_modular);
++x_modular;
return x_modular;
});

// Print something so the whole computation is not optimized out.
std::cout << x_modular << std::endl;
}

BOOST_AUTO_TEST_SUITE_END()
Loading

0 comments on commit f72c4cb

Please sign in to comment.