Skip to content

Commit e083b7c

Browse files
committed
update experiments
1 parent 853b46f commit e083b7c

File tree

2 files changed

+79
-69
lines changed

2 files changed

+79
-69
lines changed

experiment/total_multi_join.cpp

Lines changed: 40 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -18,42 +18,47 @@ void ipe_total_multi_join_time(const int round){
1818
auto pp_customer = IpeJoin::pp_gen(5, 8);
1919
auto msk_customer = IpeJoin::msk_gen(pp_customer);
2020

21-
// Create holder for timings.
22-
std::chrono::duration<double, std::milli> time{};
23-
24-
// Create a random vector of desired length.
25-
auto y_order = Helper::rand_int_mat(8, 5, 1, std::numeric_limits<int>::max());
26-
auto y_customer = Helper::rand_int_mat(7, 5, 1, std::numeric_limits<int>::max());
27-
28-
// Total timings.
29-
auto start = std::chrono::high_resolution_clock::now();
30-
auto sk_order = IpeJoin::keygen(pp_order, msk_order, y_order);
31-
auto sk_customer = IpeJoin::keygen(pp_customer, msk_customer, y_customer);
32-
auto end = std::chrono::high_resolution_clock::now();
33-
time += end - start;
34-
35-
// Timing for order.
36-
for (auto& order_row: order){
37-
auto ct_order = IpeJoin::enc(pp_order, msk_order, order_row, 1);
38-
// Total timings.
39-
start = std::chrono::high_resolution_clock::now();
40-
std::ignore = IpeJoin::dec(ct_order, sk_order);
41-
end = std::chrono::high_resolution_clock::now();
42-
time += end - start;
43-
}
21+
for (int num_col = 2; num_col <= 15; ++num_col){
22+
// Create holder for timings.
23+
std::chrono::duration<double, std::milli> time{};
4424

45-
// Timing for customer.
46-
for (auto& customer_row: customer){
47-
auto ct_customer = IpeJoin::enc(pp_order, msk_order, customer_row, 1);
48-
// Total timings.
49-
start = std::chrono::high_resolution_clock::now();
50-
std::ignore = IpeJoin::dec(ct_customer, sk_customer);
51-
end = std::chrono::high_resolution_clock::now();
52-
time += end - start;
53-
}
25+
// Compute round number of total time.
26+
for (int i = 0; i < round; ++i){
27+
// Create a random vector of desired length.
28+
auto y_order = Helper::rand_int_mat(8, 5, 1, std::numeric_limits<int>::max());
29+
auto y_customer = Helper::rand_int_mat(7, 5, 1, std::numeric_limits<int>::max());
30+
31+
// Total timings.
32+
auto start = std::chrono::high_resolution_clock::now();
33+
auto sk_order = IpeJoin::keygen(pp_order, msk_order, y_order);
34+
auto sk_customer = IpeJoin::keygen(pp_customer, msk_customer, y_customer);
35+
auto end = std::chrono::high_resolution_clock::now();
36+
time += end - start;
5437

55-
// Output the time.
56-
file << time.count() / round << std::endl;
38+
// Timing for order.
39+
for (auto& order_row: order){
40+
auto ct_order = IpeJoin::enc(pp_order, msk_order, order_row, 1);
41+
// Total timings.
42+
start = std::chrono::high_resolution_clock::now();
43+
std::ignore = IpeJoin::dec(ct_order, sk_order);
44+
end = std::chrono::high_resolution_clock::now();
45+
time += end - start;
46+
}
47+
48+
// Timing for customer.
49+
for (auto& customer_row: customer){
50+
auto ct_customer = IpeJoin::enc(pp_order, msk_order, customer_row, 1);
51+
// Total timings.
52+
start = std::chrono::high_resolution_clock::now();
53+
std::ignore = IpeJoin::dec(ct_customer, sk_customer);
54+
end = std::chrono::high_resolution_clock::now();
55+
time += end - start;
56+
}
57+
}
58+
59+
// Output the time.
60+
file << "(" << num_col << ", " << time.count() / round << ")" << std::endl;
61+
}
5762

5863
// Close the BP.
5964
BP::close();
@@ -81,7 +86,7 @@ void our_total_multi_join_time(const int round){
8186
// Create holder for timings.
8287
std::chrono::duration<double, std::milli> time{};
8388

84-
// Perform round number of Enc.
89+
// Compute round number of total time.
8590
for (int i = 0; i < round; ++i){
8691
// Create sel based on num_col.
8792
IntVec sel_order, sel_customer;

experiment/total_single_join.cpp

Lines changed: 39 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -18,42 +18,47 @@ void ipe_total_single_join_time(const int round){
1818
auto pp_customer = IpeJoin::pp_gen(1, 8);
1919
auto msk_customer = IpeJoin::msk_gen(pp_customer);
2020

21-
// Create holder for timings.
22-
std::chrono::duration<double, std::milli> time{};
23-
24-
// Create a random vector of desired length.
25-
auto y_order = Helper::rand_int_mat(8, 1, 1, std::numeric_limits<int>::max());
26-
auto y_customer = Helper::rand_int_mat(7, 1, 1, std::numeric_limits<int>::max());
27-
28-
// Total timings.
29-
auto start = std::chrono::high_resolution_clock::now();
30-
auto sk_order = IpeJoin::keygen(pp_order, msk_order, y_order);
31-
auto sk_customer = IpeJoin::keygen(pp_customer, msk_customer, y_customer);
32-
auto end = std::chrono::high_resolution_clock::now();
33-
time += end - start;
34-
35-
// Timing for order.
36-
for (auto& order_row: order){
37-
auto ct_order = IpeJoin::enc(pp_order, msk_order, order_row, 1);
38-
// Total timings.
39-
start = std::chrono::high_resolution_clock::now();
40-
std::ignore = IpeJoin::dec(ct_order, sk_order);
41-
end = std::chrono::high_resolution_clock::now();
42-
time += end - start;
43-
}
21+
for (int num_col = 2; num_col <= 15; ++num_col){
22+
// Create holder for timings.
23+
std::chrono::duration<double, std::milli> time{};
4424

45-
// Timing for customer.
46-
for (auto& customer_row: customer){
47-
auto ct_customer = IpeJoin::enc(pp_order, msk_order, customer_row, 1);
48-
// Total timings.
49-
start = std::chrono::high_resolution_clock::now();
50-
std::ignore = IpeJoin::dec(ct_customer, sk_customer);
51-
end = std::chrono::high_resolution_clock::now();
52-
time += end - start;
53-
}
25+
// Compute round number of total time.
26+
for (int i = 0; i < round; ++i){
27+
// Create a random vector of desired length.
28+
auto y_order = Helper::rand_int_mat(8, 1, 1, std::numeric_limits<int>::max());
29+
auto y_customer = Helper::rand_int_mat(7, 1, 1, std::numeric_limits<int>::max());
30+
31+
// Total timings.
32+
auto start = std::chrono::high_resolution_clock::now();
33+
auto sk_order = IpeJoin::keygen(pp_order, msk_order, y_order);
34+
auto sk_customer = IpeJoin::keygen(pp_customer, msk_customer, y_customer);
35+
auto end = std::chrono::high_resolution_clock::now();
36+
time += end - start;
5437

55-
// Output the time.
56-
file << time.count() / round << std::endl;
38+
// Timing for order.
39+
for (auto& order_row: order){
40+
auto ct_order = IpeJoin::enc(pp_order, msk_order, order_row, 1);
41+
// Total timings.
42+
start = std::chrono::high_resolution_clock::now();
43+
std::ignore = IpeJoin::dec(ct_order, sk_order);
44+
end = std::chrono::high_resolution_clock::now();
45+
time += end - start;
46+
}
47+
48+
// Timing for customer.
49+
for (auto& customer_row: customer){
50+
auto ct_customer = IpeJoin::enc(pp_order, msk_order, customer_row, 1);
51+
// Total timings.
52+
start = std::chrono::high_resolution_clock::now();
53+
std::ignore = IpeJoin::dec(ct_customer, sk_customer);
54+
end = std::chrono::high_resolution_clock::now();
55+
time += end - start;
56+
}
57+
}
58+
59+
// Output the time.
60+
file << "(" << num_col << ", " << time.count() / round << ")" << std::endl;
61+
}
5762

5863
// Close the BP.
5964
BP::close();

0 commit comments

Comments
 (0)