Clearmatics Libsnark  0.1
C++ library for zkSNARK proofs
profile_routing_algorithms.cpp
Go to the documentation of this file.
1 
13 #include <algorithm>
14 #include <libff/common/profiling.hpp>
17 
18 using namespace libsnark;
19 
20 void profile_benes_algorithm(const size_t n)
21 {
22  printf("* Size: %zu\n", n);
23 
24  assert(n == 1ul << libff::log2(n));
25 
26  libff::enter_block("Generate permutation");
27  integer_permutation permutation(n);
28  permutation.random_shuffle();
29  libff::leave_block("Generate permutation");
30 
31  libff::enter_block("Generate Benes routing assignment");
32  const benes_routing routing = get_benes_routing(permutation);
33  libff::leave_block("Generate Benes routing assignment");
34 }
35 
36 void profile_as_waksman_algorithm(const size_t n)
37 {
38  printf("* Size: %zu\n", n);
39 
40  libff::enter_block("Generate permutation");
41  integer_permutation permutation(n);
42  permutation.random_shuffle();
43  libff::leave_block("Generate permutation");
44 
45  libff::enter_block("Generate AS-Waksman routing assignment");
46  const as_waksman_routing routing = get_as_waksman_routing(permutation);
47  libff::leave_block("Generate AS-Waksman routing assignment");
48 }
49 
50 int main()
51 {
52  libff::start_profiling();
53 
54  for (size_t n = 1ul << 10; n <= 1ul << 20; n <<= 1) {
56  }
57 
58  for (size_t n = 1ul << 10; n <= 1ul << 20; n <<= 1) {
60  }
61 }
libsnark
Definition: accumulation_vector.hpp:18
profile_as_waksman_algorithm
void profile_as_waksman_algorithm(const size_t n)
Definition: profile_routing_algorithms.cpp:36
libsnark::integer_permutation::random_shuffle
void random_shuffle()
Definition: integer_permutation.cpp:122
profile_benes_algorithm
void profile_benes_algorithm(const size_t n)
Definition: profile_routing_algorithms.cpp:20
main
int main()
Definition: profile_routing_algorithms.cpp:50
libsnark::get_as_waksman_routing
as_waksman_routing get_as_waksman_routing(const integer_permutation &permutation)
Definition: as_waksman_routing_algorithm.cpp:568
benes_routing_algorithm.hpp
libsnark::benes_routing
std::vector< libff::bit_vector > benes_routing
Definition: benes_routing_algorithm.hpp:61
libsnark::integer_permutation
Definition: integer_permutation.hpp:22
libsnark::as_waksman_routing
std::vector< std::map< size_t, bool > > as_waksman_routing
Definition: as_waksman_routing_algorithm.hpp:102
libsnark::get_benes_routing
benes_routing get_benes_routing(const integer_permutation &permutation)
Definition: benes_routing_algorithm.cpp:320
as_waksman_routing_algorithm.hpp