diff options
author | yazevnul <yazevnul@yandex-team.ru> | 2022-02-10 16:46:46 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:46:46 +0300 |
commit | 8cbc307de0221f84c80c42dcbe07d40727537e2c (patch) | |
tree | 625d5a673015d1df891e051033e9fcde5c7be4e5 /util/generic/benchmark/rotate_bits | |
parent | 30d1ef3941e0dc835be7609de5ebee66958f215a (diff) | |
download | ydb-8cbc307de0221f84c80c42dcbe07d40727537e2c.tar.gz |
Restoring authorship annotation for <yazevnul@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'util/generic/benchmark/rotate_bits')
-rw-r--r-- | util/generic/benchmark/rotate_bits/main.cpp | 124 | ||||
-rw-r--r-- | util/generic/benchmark/rotate_bits/metrics/main.py | 8 | ||||
-rw-r--r-- | util/generic/benchmark/rotate_bits/metrics/ya.make | 26 | ||||
-rw-r--r-- | util/generic/benchmark/rotate_bits/ya.make | 20 |
4 files changed, 89 insertions, 89 deletions
diff --git a/util/generic/benchmark/rotate_bits/main.cpp b/util/generic/benchmark/rotate_bits/main.cpp index 057edbe864..929d2c4ca9 100644 --- a/util/generic/benchmark/rotate_bits/main.cpp +++ b/util/generic/benchmark/rotate_bits/main.cpp @@ -1,66 +1,66 @@ #include <library/cpp/testing/benchmark/bench.h> - -#include <util/generic/vector.h> -#include <util/generic/xrange.h> -#include <util/generic/singleton.h> - -#include <util/random/fast.h> - -namespace { - template <typename T> - struct TExample { - T Value; - ui8 Shift; - }; - - template <typename T, size_t N> - struct TExamplesHolder { - TExamplesHolder() + +#include <util/generic/vector.h> +#include <util/generic/xrange.h> +#include <util/generic/singleton.h> + +#include <util/random/fast.h> + +namespace { + template <typename T> + struct TExample { + T Value; + ui8 Shift; + }; + + template <typename T, size_t N> + struct TExamplesHolder { + TExamplesHolder() : Examples(N) { - TFastRng<ui64> prng{42u * sizeof(T) * N}; - for (auto& e : Examples) { - e.Value = prng(); - e.Shift = prng() % (8 * sizeof(T)); - } - } - + TFastRng<ui64> prng{42u * sizeof(T) * N}; + for (auto& e : Examples) { + e.Value = prng(); + e.Shift = prng() % (8 * sizeof(T)); + } + } + TVector<TExample<T>> Examples; - }; -} - -#define DEFINE_BENCHMARKS_FOR_UNSIGNED_TYPES(type, count) \ - Y_CPU_BENCHMARK(LeftRotate_##type##_##count, iface) { \ - const auto& examples = Default<TExamplesHolder<type, count>>().Examples; \ - for (const auto i : xrange(iface.Iterations())) { \ - Y_UNUSED(i); \ - for (const auto e : examples) { \ - Y_DO_NOT_OPTIMIZE_AWAY(RotateBitsLeft(e.Value, e.Shift)); \ - } \ - } \ - } \ - \ - Y_CPU_BENCHMARK(RightRotate_##type##_##count, iface) { \ - const auto& examples = Default<TExamplesHolder<type, count>>().Examples; \ - for (const auto i : xrange(iface.Iterations())) { \ - Y_UNUSED(i); \ - for (const auto e : examples) { \ - Y_DO_NOT_OPTIMIZE_AWAY(RotateBitsRight(e.Value, e.Shift)); \ - } \ - } \ - } - -DEFINE_BENCHMARKS_FOR_UNSIGNED_TYPES(ui8, 1) -DEFINE_BENCHMARKS_FOR_UNSIGNED_TYPES(ui8, 10) -DEFINE_BENCHMARKS_FOR_UNSIGNED_TYPES(ui8, 100) -DEFINE_BENCHMARKS_FOR_UNSIGNED_TYPES(ui16, 1) -DEFINE_BENCHMARKS_FOR_UNSIGNED_TYPES(ui16, 10) -DEFINE_BENCHMARKS_FOR_UNSIGNED_TYPES(ui16, 100) -DEFINE_BENCHMARKS_FOR_UNSIGNED_TYPES(ui32, 1) -DEFINE_BENCHMARKS_FOR_UNSIGNED_TYPES(ui32, 10) -DEFINE_BENCHMARKS_FOR_UNSIGNED_TYPES(ui32, 100) -DEFINE_BENCHMARKS_FOR_UNSIGNED_TYPES(ui64, 1) -DEFINE_BENCHMARKS_FOR_UNSIGNED_TYPES(ui64, 10) -DEFINE_BENCHMARKS_FOR_UNSIGNED_TYPES(ui64, 100) - -#undef DEFINE_BENCHMARKS_FOR_UNSIGNED_TYPES + }; +} + +#define DEFINE_BENCHMARKS_FOR_UNSIGNED_TYPES(type, count) \ + Y_CPU_BENCHMARK(LeftRotate_##type##_##count, iface) { \ + const auto& examples = Default<TExamplesHolder<type, count>>().Examples; \ + for (const auto i : xrange(iface.Iterations())) { \ + Y_UNUSED(i); \ + for (const auto e : examples) { \ + Y_DO_NOT_OPTIMIZE_AWAY(RotateBitsLeft(e.Value, e.Shift)); \ + } \ + } \ + } \ + \ + Y_CPU_BENCHMARK(RightRotate_##type##_##count, iface) { \ + const auto& examples = Default<TExamplesHolder<type, count>>().Examples; \ + for (const auto i : xrange(iface.Iterations())) { \ + Y_UNUSED(i); \ + for (const auto e : examples) { \ + Y_DO_NOT_OPTIMIZE_AWAY(RotateBitsRight(e.Value, e.Shift)); \ + } \ + } \ + } + +DEFINE_BENCHMARKS_FOR_UNSIGNED_TYPES(ui8, 1) +DEFINE_BENCHMARKS_FOR_UNSIGNED_TYPES(ui8, 10) +DEFINE_BENCHMARKS_FOR_UNSIGNED_TYPES(ui8, 100) +DEFINE_BENCHMARKS_FOR_UNSIGNED_TYPES(ui16, 1) +DEFINE_BENCHMARKS_FOR_UNSIGNED_TYPES(ui16, 10) +DEFINE_BENCHMARKS_FOR_UNSIGNED_TYPES(ui16, 100) +DEFINE_BENCHMARKS_FOR_UNSIGNED_TYPES(ui32, 1) +DEFINE_BENCHMARKS_FOR_UNSIGNED_TYPES(ui32, 10) +DEFINE_BENCHMARKS_FOR_UNSIGNED_TYPES(ui32, 100) +DEFINE_BENCHMARKS_FOR_UNSIGNED_TYPES(ui64, 1) +DEFINE_BENCHMARKS_FOR_UNSIGNED_TYPES(ui64, 10) +DEFINE_BENCHMARKS_FOR_UNSIGNED_TYPES(ui64, 100) + +#undef DEFINE_BENCHMARKS_FOR_UNSIGNED_TYPES diff --git a/util/generic/benchmark/rotate_bits/metrics/main.py b/util/generic/benchmark/rotate_bits/metrics/main.py index b30555775f..d752885779 100644 --- a/util/generic/benchmark/rotate_bits/metrics/main.py +++ b/util/generic/benchmark/rotate_bits/metrics/main.py @@ -1,5 +1,5 @@ -import yatest.common as yc - - -def test_export_metrics(metrics): +import yatest.common as yc + + +def test_export_metrics(metrics): metrics.set_benchmark(yc.execute_benchmark('util/generic/benchmark/rotate_bits/rotate_bits', threads=8)) diff --git a/util/generic/benchmark/rotate_bits/metrics/ya.make b/util/generic/benchmark/rotate_bits/metrics/ya.make index ac27d2f845..3bef9fae8a 100644 --- a/util/generic/benchmark/rotate_bits/metrics/ya.make +++ b/util/generic/benchmark/rotate_bits/metrics/ya.make @@ -1,21 +1,21 @@ -OWNER( - yazevnul +OWNER( + yazevnul g:util -) +) SUBSCRIBER(g:util-subscribers) - + PY2TEST() - + SIZE(LARGE) - -TAG( + +TAG( ya:force_sandbox - sb:intel_e5_2660v1 + sb:intel_e5_2660v1 ya:fat -) - +) + TEST_SRCS(main.py) - + DEPENDS(util/generic/benchmark/rotate_bits) - -END() + +END() diff --git a/util/generic/benchmark/rotate_bits/ya.make b/util/generic/benchmark/rotate_bits/ya.make index 976977014f..a475d0c67f 100644 --- a/util/generic/benchmark/rotate_bits/ya.make +++ b/util/generic/benchmark/rotate_bits/ya.make @@ -1,13 +1,13 @@ -OWNER( - yazevnul +OWNER( + yazevnul g:util -) +) SUBSCRIBER(g:util-subscribers) - + Y_BENCHMARK() - -SRCS( - main.cpp -) - -END() + +SRCS( + main.cpp +) + +END() |