aboutsummaryrefslogtreecommitdiffstats
path: root/util/string/benchmark
diff options
context:
space:
mode:
authorAlexey Salmin <alexey.salmin@gmail.com>2022-02-10 16:49:37 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:49:37 +0300
commit3c5b1607b38f637d2f3313791ed25c2e080d2647 (patch)
tree99be7b96e7c66612fbca94331100ef3b5fedcb88 /util/string/benchmark
parentde89752358147d7b25ef59a85b431bb564068a49 (diff)
downloadydb-3c5b1607b38f637d2f3313791ed25c2e080d2647.tar.gz
Restoring authorship annotation for Alexey Salmin <alexey.salmin@gmail.com>. Commit 1 of 2.
Diffstat (limited to 'util/string/benchmark')
-rw-r--r--util/string/benchmark/join/main.cpp160
-rw-r--r--util/string/benchmark/join/metrics/main.py8
-rw-r--r--util/string/benchmark/join/metrics/ya.make28
-rw-r--r--util/string/benchmark/join/ya.make22
-rw-r--r--util/string/benchmark/ya.make4
5 files changed, 111 insertions, 111 deletions
diff --git a/util/string/benchmark/join/main.cpp b/util/string/benchmark/join/main.cpp
index 1a8633d3a8..94466069d4 100644
--- a/util/string/benchmark/join/main.cpp
+++ b/util/string/benchmark/join/main.cpp
@@ -1,70 +1,70 @@
#include <library/cpp/testing/benchmark/bench.h>
-
-#include <util/generic/function.h>
-#include <util/generic/singleton.h>
-#include <util/generic/vector.h>
-#include <util/generic/xrange.h>
-#include <util/random/fast.h>
-#include <util/string/cast.h>
-#include <util/string/join.h>
-
-namespace {
- // This class assigns random values to variadic lists of variables of different types.
- // It can be used to randomize a tuple via Apply() (arcadia version of std::apply).
- class TRandomizer {
- public:
- TRandomizer(ui64 seed)
- : Prng(seed)
- {
- }
-
- void Randomize(ui16& i) {
- i = static_cast<ui16>(Prng.GenRand());
- }
-
- void Randomize(ui32& i) {
- i = static_cast<ui32>(Prng.GenRand());
- }
-
- void Randomize(double& d) {
- d = Prng.GenRandReal4() + Prng.Uniform(Max<ui16>());
- }
-
- void Randomize(TString& s) {
- s = ::ToString(Prng.GenRand());
- }
-
+
+#include <util/generic/function.h>
+#include <util/generic/singleton.h>
+#include <util/generic/vector.h>
+#include <util/generic/xrange.h>
+#include <util/random/fast.h>
+#include <util/string/cast.h>
+#include <util/string/join.h>
+
+namespace {
+ // This class assigns random values to variadic lists of variables of different types.
+ // It can be used to randomize a tuple via Apply() (arcadia version of std::apply).
+ class TRandomizer {
+ public:
+ TRandomizer(ui64 seed)
+ : Prng(seed)
+ {
+ }
+
+ void Randomize(ui16& i) {
+ i = static_cast<ui16>(Prng.GenRand());
+ }
+
+ void Randomize(ui32& i) {
+ i = static_cast<ui32>(Prng.GenRand());
+ }
+
+ void Randomize(double& d) {
+ d = Prng.GenRandReal4() + Prng.Uniform(Max<ui16>());
+ }
+
+ void Randomize(TString& s) {
+ s = ::ToString(Prng.GenRand());
+ }
+
template <typename T, typename... TArgs>
- void Randomize(T& t, TArgs&... args) {
- Randomize(t);
- Randomize(args...);
- }
-
- private:
- TFastRng<ui64> Prng;
- };
-
+ void Randomize(T& t, TArgs&... args) {
+ Randomize(t);
+ Randomize(args...);
+ }
+
+ private:
+ TFastRng<ui64> Prng;
+ };
+
template <size_t N, typename... T>
- struct TExamplesHolder {
+ struct TExamplesHolder {
using TExamples = TVector<std::tuple<T...>>;
- TExamples Examples;
-
- TExamplesHolder()
- : Examples(N)
- {
- TRandomizer r{N * sizeof(typename TExamples::value_type) * 42};
- for (auto& x : Examples) {
+ TExamples Examples;
+
+ TExamplesHolder()
+ : Examples(N)
+ {
+ TRandomizer r{N * sizeof(typename TExamples::value_type) * 42};
+ for (auto& x : Examples) {
Apply([&r](T&... t) { r.Randomize(t...); }, x);
- }
- }
- };
-
+ }
+ }
+ };
+
template <typename... TArgs>
- TString JoinTuple(std::tuple<TArgs...> t) {
- return Apply([](TArgs... x) -> TString { return Join("-", x...); }, t);
- }
-}
-
+ 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; \
@@ -74,22 +74,22 @@ namespace {
Y_DO_NOT_OPTIMIZE_AWAY(JoinTuple(e)); \
} \
} \
- }
-
-DEFINE_BENCHMARK(100, SS, TString, TString);
-DEFINE_BENCHMARK(100, SSS, TString, TString, TString);
-DEFINE_BENCHMARK(100, SSSSS, TString, TString, TString, TString, TString);
-
-DEFINE_BENCHMARK(100, ss, ui16, ui16);
-DEFINE_BENCHMARK(100, SsS, TString, ui16, TString);
-DEFINE_BENCHMARK(100, SsSsS, TString, ui16, TString, ui16, TString);
-
-DEFINE_BENCHMARK(100, ii, ui32, ui32);
-DEFINE_BENCHMARK(100, SiS, TString, ui32, TString);
-DEFINE_BENCHMARK(100, SiSiS, TString, ui32, TString, ui32, TString);
-
-DEFINE_BENCHMARK(100, dd, double, double);
-DEFINE_BENCHMARK(100, SdS, TString, double, TString);
-DEFINE_BENCHMARK(100, SdSdS, TString, double, TString, double, TString);
-
-#undef DEFINE_BENCHMARK
+ }
+
+DEFINE_BENCHMARK(100, SS, TString, TString);
+DEFINE_BENCHMARK(100, SSS, TString, TString, TString);
+DEFINE_BENCHMARK(100, SSSSS, TString, TString, TString, TString, TString);
+
+DEFINE_BENCHMARK(100, ss, ui16, ui16);
+DEFINE_BENCHMARK(100, SsS, TString, ui16, TString);
+DEFINE_BENCHMARK(100, SsSsS, TString, ui16, TString, ui16, TString);
+
+DEFINE_BENCHMARK(100, ii, ui32, ui32);
+DEFINE_BENCHMARK(100, SiS, TString, ui32, TString);
+DEFINE_BENCHMARK(100, SiSiS, TString, ui32, TString, ui32, TString);
+
+DEFINE_BENCHMARK(100, dd, double, double);
+DEFINE_BENCHMARK(100, SdS, TString, double, TString);
+DEFINE_BENCHMARK(100, SdSdS, TString, double, TString, double, TString);
+
+#undef DEFINE_BENCHMARK
diff --git a/util/string/benchmark/join/metrics/main.py b/util/string/benchmark/join/metrics/main.py
index 1ed5014808..60eb0e470f 100644
--- a/util/string/benchmark/join/metrics/main.py
+++ b/util/string/benchmark/join/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/string/benchmark/join/join', threads=8))
diff --git a/util/string/benchmark/join/metrics/ya.make b/util/string/benchmark/join/metrics/ya.make
index 08ff3a149f..bdbf806aa2 100644
--- a/util/string/benchmark/join/metrics/ya.make
+++ b/util/string/benchmark/join/metrics/ya.make
@@ -1,21 +1,21 @@
-OWNER(
- salmin
- g:util
-)
+OWNER(
+ salmin
+ 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/string/benchmark/join)
-
-END()
+
+END()
diff --git a/util/string/benchmark/join/ya.make b/util/string/benchmark/join/ya.make
index dfcc1d264e..6ba2d2dadb 100644
--- a/util/string/benchmark/join/ya.make
+++ b/util/string/benchmark/join/ya.make
@@ -1,13 +1,13 @@
Y_BENCHMARK()
-
-OWNER(
- salmin
- g:util
-)
+
+OWNER(
+ salmin
+ g:util
+)
SUBSCRIBER(g:util-subscribers)
-
-SRCS(
- main.cpp
-)
-
-END()
+
+SRCS(
+ main.cpp
+)
+
+END()
diff --git a/util/string/benchmark/ya.make b/util/string/benchmark/ya.make
index 266b53c7b3..e6ab78b6f6 100644
--- a/util/string/benchmark/ya.make
+++ b/util/string/benchmark/ya.make
@@ -9,8 +9,8 @@ RECURSE(
cast
float_to_string
float_to_string/metrics
- join
- join/metrics
+ join
+ join/metrics
subst_global
subst_global/metrics
)