diff options
author | Anton Samokhvalov <pg83@yandex.ru> | 2022-02-10 16:45:15 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:45:15 +0300 |
commit | 72cb13b4aff9bc9cf22e49251bc8fd143f82538f (patch) | |
tree | da2c34829458c7d4e74bdfbdf85dff449e9e7fb8 /util/string/benchmark/join/main.cpp | |
parent | 778e51ba091dc39e7b7fcab2b9cf4dbedfb6f2b5 (diff) | |
download | ydb-72cb13b4aff9bc9cf22e49251bc8fd143f82538f.tar.gz |
Restoring authorship annotation for Anton Samokhvalov <pg83@yandex.ru>. Commit 1 of 2.
Diffstat (limited to 'util/string/benchmark/join/main.cpp')
-rw-r--r-- | util/string/benchmark/join/main.cpp | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/util/string/benchmark/join/main.cpp b/util/string/benchmark/join/main.cpp index 1a8633d3a8..4742089bf8 100644 --- a/util/string/benchmark/join/main.cpp +++ b/util/string/benchmark/join/main.cpp @@ -34,7 +34,7 @@ namespace { s = ::ToString(Prng.GenRand()); } - template <typename T, typename... TArgs> + template <typename T, typename... TArgs> void Randomize(T& t, TArgs&... args) { Randomize(t); Randomize(args...); @@ -44,7 +44,7 @@ namespace { TFastRng<ui64> Prng; }; - template <size_t N, typename... T> + template <size_t N, typename... T> struct TExamplesHolder { using TExamples = TVector<std::tuple<T...>>; TExamples Examples; @@ -54,26 +54,26 @@ namespace { { TRandomizer r{N * sizeof(typename TExamples::value_type) * 42}; for (auto& x : Examples) { - Apply([&r](T&... t) { r.Randomize(t...); }, x); + Apply([&r](T&... t) { r.Randomize(t...); }, x); } } }; - template <typename... TArgs> + template <typename... TArgs> TString JoinTuple(std::tuple<TArgs...> t) { return Apply([](TArgs... x) -> TString { return Join("-", x...); }, t); } } -#define DEFINE_BENCHMARK(count, types, ...) \ - Y_CPU_BENCHMARK(Join_##count##_##types, iface) { \ - const auto& examples = Default<TExamplesHolder<count, __VA_ARGS__>>().Examples; \ - for (const auto i : xrange(iface.Iterations())) { \ - Y_UNUSED(i); \ - for (const auto e : examples) { \ - Y_DO_NOT_OPTIMIZE_AWAY(JoinTuple(e)); \ - } \ - } \ +#define DEFINE_BENCHMARK(count, types, ...) \ + Y_CPU_BENCHMARK(Join_##count##_##types, iface) { \ + const auto& examples = Default<TExamplesHolder<count, __VA_ARGS__>>().Examples; \ + for (const auto i : xrange(iface.Iterations())) { \ + Y_UNUSED(i); \ + for (const auto e : examples) { \ + Y_DO_NOT_OPTIMIZE_AWAY(JoinTuple(e)); \ + } \ + } \ } DEFINE_BENCHMARK(100, SS, TString, TString); |