Skip to content

Commit 8fa93ee

Browse files
committed
decrease latency
1 parent 816eff9 commit 8fa93ee

File tree

12 files changed

+627
-613
lines changed

12 files changed

+627
-613
lines changed

src/3rd_party/fecpp.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -502,7 +502,7 @@ namespace fecpp
502502
std::vector<std::unique_ptr<uint8_t[]>> redundan;
503503
for (size_t i = K; i != N; ++i)
504504
{
505-
redundan.emplace_back(std::make_unique<uint8_t[]>(block_size));
505+
redundan.emplace_back(std::make_unique_for_overwrite<uint8_t[]>(block_size));
506506
size_t index = i - K;
507507
for (size_t j = 0; j != K; ++j)
508508
addmul(redundan[index].get(), input + j * block_size,
@@ -521,8 +521,8 @@ namespace fecpp
521521
return {};
522522

523523
std::map<size_t, std::vector<uint8_t>> missing_blocks;
524-
std::unique_ptr<uint8_t[]> m_dec = std::make_unique<uint8_t[]>(K * K);
525-
std::unique_ptr<size_t[]> indexes = std::make_unique<size_t[]>(K);
524+
std::unique_ptr<uint8_t[]> m_dec = std::make_unique_for_overwrite<uint8_t[]>(K * K);
525+
std::unique_ptr<size_t[]> indexes = std::make_unique_for_overwrite<size_t[]>(K);
526526
std::unique_ptr<const uint8_t *[]> sharesv = std::make_unique<const uint8_t * []>(K);
527527

528528
std::map<size_t, const uint8_t*>::const_iterator shares_b_iter = shares.begin();

src/main.cpp

Lines changed: 33 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,15 @@
1616
int main(int argc, char *argv[])
1717
{
1818
#ifdef __cpp_lib_format
19-
std::cout << std::format("{} version 20250301\n", app_name);
19+
std::cout << std::format("{} version 20250406\n", app_name);
2020
if (argc <= 1)
2121
{
2222
std::cout << std::format("Usage: {} config1.conf\n", app_name);
2323
std::cout << std::format(" {} config1.conf config2.conf...\n", (int)app_name.length(), app_name.data());
2424
return 0;
2525
}
2626
#else
27-
std::cout << app_name << " version 20250301\n";
27+
std::cout << app_name << " version 20250406\n";
2828
if (argc <= 1)
2929
{
3030
std::cout << "Usage: " << app_name << " config1.conf\n";
@@ -33,33 +33,34 @@ int main(int argc, char *argv[])
3333
}
3434
#endif
3535

36-
uint16_t thread_group_count = 2;
37-
int io_thread_count = std::thread::hardware_concurrency() == 1 ? 1 : 2;
38-
std::unique_ptr<ttp::task_thread_pool> parallel_pool_1;
39-
std::unique_ptr<ttp::task_thread_pool> parallel_pool_2;
40-
if (std::thread::hardware_concurrency() > 2)
41-
{
42-
auto thread_counts = std::thread::hardware_concurrency();
43-
thread_group_count = thread_counts;
44-
io_thread_count = (int)round(log2(thread_counts));
45-
}
46-
47-
if (std::thread::hardware_concurrency() > 1)
48-
{
49-
parallel_pool_1 = std::make_unique<ttp::task_thread_pool>();
50-
parallel_pool_2 = std::make_unique<ttp::task_thread_pool>();
51-
}
52-
53-
ttp::task_group_pool task_groups{ thread_group_count };
54-
task_pool_colloector task_pools =
55-
{
56-
.parallel_encryption_pool = parallel_pool_1.get(),
57-
.parallel_decryption_pool = parallel_pool_2.get(),
58-
.listener_parallels = parallel_pool_1.get(),
59-
.forwarder_parallels = parallel_pool_2.get()
60-
};
61-
62-
asio::io_context ioc{ io_thread_count };
36+
//uint16_t thread_group_count = 2;
37+
//int io_thread_count = std::thread::hardware_concurrency() == 1 ? 1 : 2;
38+
//std::unique_ptr<ttp::task_thread_pool> parallel_pool_1;
39+
//std::unique_ptr<ttp::task_thread_pool> parallel_pool_2;
40+
//if (std::thread::hardware_concurrency() > 2)
41+
//{
42+
// auto thread_counts = std::thread::hardware_concurrency();
43+
// thread_group_count = thread_counts;
44+
// io_thread_count = (int)round(log2(thread_counts));
45+
//}
46+
47+
//if (std::thread::hardware_concurrency() > 1)
48+
//{
49+
// parallel_pool_1 = std::make_unique<ttp::task_thread_pool>();
50+
// parallel_pool_2 = std::make_unique<ttp::task_thread_pool>();
51+
//}
52+
53+
//ttp::task_group_pool task_groups{ thread_group_count };
54+
//task_pool_colloector task_pools =
55+
//{
56+
// .parallel_encryption_pool = parallel_pool_1.get(),
57+
// .parallel_decryption_pool = parallel_pool_2.get(),
58+
// .listener_parallels = parallel_pool_1.get(),
59+
// .forwarder_parallels = parallel_pool_2.get()
60+
//};
61+
62+
//asio::io_context ioc{ io_thread_count };
63+
asio::io_context ioc;
6364

6465
std::vector<client_mode> clients;
6566
std::vector<relay_mode> relays;
@@ -117,13 +118,13 @@ int main(int argc, char *argv[])
117118
switch (settings.mode)
118119
{
119120
case running_mode::client:
120-
clients.emplace_back(client_mode(ioc, task_groups, task_pools, settings));
121+
clients.emplace_back(client_mode(ioc, /*task_groups, task_pools,*/ settings));
121122
break;
122123
case running_mode::relay:
123-
relays.emplace_back(relay_mode(ioc, task_groups, task_pools, settings));
124+
relays.emplace_back(relay_mode(ioc, /*task_groups, task_pools,*/ settings));
124125
break;
125126
case running_mode::server:
126-
servers.emplace_back(server_mode(ioc, task_groups, task_pools, settings));
127+
servers.emplace_back(server_mode(ioc, /*task_groups, task_pools,*/ settings));
127128
break;
128129
default:
129130
break;

0 commit comments

Comments
 (0)