aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/threading/future/perf/main.cpp
diff options
context:
space:
mode:
authorvskipin <vskipin@yandex-team.ru>2022-02-10 16:46:00 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:46:00 +0300
commit4d8b546b89b5afc08cf3667e176271c7ba935f33 (patch)
tree1a2c5ffcf89eb53ecd79dbc9bc0a195c27404d0c /library/cpp/threading/future/perf/main.cpp
parent4e4b78bd7b67e2533da4dbb9696374a6d6068e32 (diff)
downloadydb-4d8b546b89b5afc08cf3667e176271c7ba935f33.tar.gz
Restoring authorship annotation for <vskipin@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'library/cpp/threading/future/perf/main.cpp')
-rw-r--r--library/cpp/threading/future/perf/main.cpp70
1 files changed, 35 insertions, 35 deletions
diff --git a/library/cpp/threading/future/perf/main.cpp b/library/cpp/threading/future/perf/main.cpp
index 71e9e293de..5a0690af47 100644
--- a/library/cpp/threading/future/perf/main.cpp
+++ b/library/cpp/threading/future/perf/main.cpp
@@ -1,50 +1,50 @@
#include <library/cpp/testing/benchmark/bench.h>
#include <library/cpp/threading/future/future.h>
-
+
#include <util/generic/string.h>
-#include <util/generic/xrange.h>
-
-using namespace NThreading;
-
-template <typename T>
+#include <util/generic/xrange.h>
+
+using namespace NThreading;
+
+template <typename T>
void TestAllocPromise(const NBench::NCpu::TParams& iface) {
for (const auto it : xrange(iface.Iterations())) {
- Y_UNUSED(it);
- Y_DO_NOT_OPTIMIZE_AWAY(NewPromise<T>());
- }
-}
-
-template <typename T>
+ Y_UNUSED(it);
+ Y_DO_NOT_OPTIMIZE_AWAY(NewPromise<T>());
+ }
+}
+
+template <typename T>
TPromise<T> SetPromise(T value) {
- auto promise = NewPromise<T>();
- promise.SetValue(value);
- return promise;
-}
-
-template <typename T>
+ auto promise = NewPromise<T>();
+ promise.SetValue(value);
+ return promise;
+}
+
+template <typename T>
void TestSetPromise(const NBench::NCpu::TParams& iface, T value) {
for (const auto it : xrange(iface.Iterations())) {
- Y_UNUSED(it);
- Y_DO_NOT_OPTIMIZE_AWAY(SetPromise(value));
- }
-}
-
+ Y_UNUSED(it);
+ Y_DO_NOT_OPTIMIZE_AWAY(SetPromise(value));
+ }
+}
+
Y_CPU_BENCHMARK(AllocPromiseVoid, iface) {
- TestAllocPromise<void>(iface);
-}
-
+ TestAllocPromise<void>(iface);
+}
+
Y_CPU_BENCHMARK(AllocPromiseUI64, iface) {
- TestAllocPromise<ui64>(iface);
-}
-
+ TestAllocPromise<ui64>(iface);
+}
+
Y_CPU_BENCHMARK(AllocPromiseStroka, iface) {
TestAllocPromise<TString>(iface);
-}
-
+}
+
Y_CPU_BENCHMARK(SetPromiseUI64, iface) {
- TestSetPromise<ui64>(iface, 1234567890ull);
-}
-
+ TestSetPromise<ui64>(iface, 1234567890ull);
+}
+
Y_CPU_BENCHMARK(SetPromiseStroka, iface) {
TestSetPromise<TString>(iface, "test test test");
-}
+}