From 8034c2cf4e733b803b062a8b330683e1b3b06137 Mon Sep 17 00:00:00 2001 From: levlam Date: Fri, 28 Feb 2025 10:03:53 +0300 Subject: Use using in HashSet benchmark. --- tdutils/test/hashset_benchmark.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'tdutils') diff --git a/tdutils/test/hashset_benchmark.cpp b/tdutils/test/hashset_benchmark.cpp index 81c729ffe..34250cf06 100644 --- a/tdutils/test/hashset_benchmark.cpp +++ b/tdutils/test/hashset_benchmark.cpp @@ -290,7 +290,6 @@ static void BM_emplace_string(benchmark::State &state) { } } -namespace td { template static void table_remove_if(absl::flat_hash_map &table, FunctT &&func) { for (auto it = table.begin(); it != table.end();) { @@ -303,7 +302,6 @@ static void table_remove_if(absl::flat_hash_map &table, FunctT &&func) { } } } -} // namespace td template static void BM_remove_if(benchmark::State &state) { @@ -320,7 +318,8 @@ static void BM_remove_if(benchmark::State &state) { } state.ResumeTiming(); - td::table_remove_if(table, [](auto &it) { return it.second % 2 == 0; }); + using td::table_remove_if; + table_remove_if(table, [](auto &it) { return it.second % 2 == 0; }); } } @@ -421,7 +420,8 @@ static void BM_remove_if_slow(benchmark::State &state) { auto first_key = table.begin()->first; { std::size_t cnt = 0; - td::table_remove_if(table, [&cnt, n = N](auto &) { + using td::table_remove_if; + table_remove_if(table, [&cnt, n = N](auto &) { cnt += 2; return cnt <= n; }); @@ -446,7 +446,8 @@ static void BM_remove_if_slow_old(benchmark::State &state) { table.emplace(rnd() + 1, i); if (table.size() > N) { std::size_t cnt = 0; - td::table_remove_if(table, [&cnt, n = N](auto &) { + using td::table_remove_if; + table_remove_if(table, [&cnt, n = N](auto &) { cnt += 2; return cnt <= n; }); -- cgit v1.2.3