aboutsummaryrefslogtreecommitdiffstats
path: root/util/generic/benchmark/log2
diff options
context:
space:
mode:
authoryazevnul <yazevnul@yandex-team.ru>2022-02-10 16:46:46 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:46:46 +0300
commit8cbc307de0221f84c80c42dcbe07d40727537e2c (patch)
tree625d5a673015d1df891e051033e9fcde5c7be4e5 /util/generic/benchmark/log2
parent30d1ef3941e0dc835be7609de5ebee66958f215a (diff)
downloadydb-8cbc307de0221f84c80c42dcbe07d40727537e2c.tar.gz
Restoring authorship annotation for <yazevnul@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'util/generic/benchmark/log2')
-rw-r--r--util/generic/benchmark/log2/main.cpp186
-rw-r--r--util/generic/benchmark/log2/metrics/main.py8
-rw-r--r--util/generic/benchmark/log2/metrics/ya.make26
-rw-r--r--util/generic/benchmark/log2/ya.make26
4 files changed, 123 insertions, 123 deletions
diff --git a/util/generic/benchmark/log2/main.cpp b/util/generic/benchmark/log2/main.cpp
index 969f09a309..a5490aba67 100644
--- a/util/generic/benchmark/log2/main.cpp
+++ b/util/generic/benchmark/log2/main.cpp
@@ -1,30 +1,30 @@
#include <library/cpp/testing/benchmark/bench.h>
-
+
#include <library/cpp/fast_log/fast_log.h>
-
-#include <util/generic/singleton.h>
-#include <util/generic/vector.h>
-#include <util/random/fast.h>
-#include <util/generic/xrange.h>
-
-#include <cmath>
-namespace {
- template <typename T, size_t N>
- struct TExamplesHolder {
+
+#include <util/generic/singleton.h>
+#include <util/generic/vector.h>
+#include <util/random/fast.h>
+#include <util/generic/xrange.h>
+
+#include <cmath>
+namespace {
+ template <typename T, size_t N>
+ struct TExamplesHolder {
TVector<T> Examples;
-
- TExamplesHolder()
+
+ TExamplesHolder()
: Examples(N)
{
- TFastRng<ui64> prng{N * 42};
- for (auto& x : Examples) {
- x = prng.GenRandReal4() + prng.Uniform(1932); // 1934 is just a random number
- }
- }
- };
-}
-
-#define DEFINE_BENCHMARK(type, count) \
+ TFastRng<ui64> prng{N * 42};
+ for (auto& x : Examples) {
+ x = prng.GenRandReal4() + prng.Uniform(1932); // 1934 is just a random number
+ }
+ }
+ };
+}
+
+#define DEFINE_BENCHMARK(type, count) \
Y_CPU_BENCHMARK(libm_log2f_##type##_##count, iface) { \
const auto& examples = Default<TExamplesHolder<type, count>>().Examples; \
for (const auto i : xrange(iface.Iterations())) { \
@@ -44,64 +44,64 @@ namespace {
} \
} \
} \
- Y_CPU_BENCHMARK(STL_Log2_##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(std::log2(e)); \
- } \
- } \
- } \
- \
- Y_CPU_BENCHMARK(STL_Log_##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(std::log(e)); \
- } \
- } \
- } \
- \
- Y_CPU_BENCHMARK(Fast_Log2_##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(FastLog2f(e)); \
- } \
- } \
- } \
- \
+ Y_CPU_BENCHMARK(STL_Log2_##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(std::log2(e)); \
+ } \
+ } \
+ } \
+ \
+ Y_CPU_BENCHMARK(STL_Log_##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(std::log(e)); \
+ } \
+ } \
+ } \
+ \
+ Y_CPU_BENCHMARK(Fast_Log2_##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(FastLog2f(e)); \
+ } \
+ } \
+ } \
+ \
Y_CPU_BENCHMARK(FastLogf##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(FastLogf(e)); \
- } \
- } \
- } \
- \
- Y_CPU_BENCHMARK(Faster_Log2_##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) { \
+ 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(FastLogf(e)); \
+ } \
+ } \
+ } \
+ \
+ Y_CPU_BENCHMARK(Faster_Log2_##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(FasterLog2f(e)); \
- } \
- } \
- } \
- \
- Y_CPU_BENCHMARK(Faster_Log_##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_CPU_BENCHMARK(Faster_Log_##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(FasterLogf(e)); \
- } \
- } \
+ } \
+ } \
} \
\
Y_CPU_BENCHMARK(Fastest_Log2f_##type##_##count, iface) { \
@@ -122,19 +122,19 @@ namespace {
Y_DO_NOT_OPTIMIZE_AWAY(FastestLogf(e)); \
} \
} \
- }
-
-DEFINE_BENCHMARK(float, 1)
-DEFINE_BENCHMARK(float, 2)
-DEFINE_BENCHMARK(float, 4)
-DEFINE_BENCHMARK(float, 8)
-DEFINE_BENCHMARK(float, 16)
-DEFINE_BENCHMARK(float, 32)
-DEFINE_BENCHMARK(float, 64)
-DEFINE_BENCHMARK(float, 128)
-DEFINE_BENCHMARK(float, 256)
-DEFINE_BENCHMARK(float, 1024)
-DEFINE_BENCHMARK(float, 2048)
-DEFINE_BENCHMARK(float, 4096)
-
-#undef DEFINE_BENCHMARK
+ }
+
+DEFINE_BENCHMARK(float, 1)
+DEFINE_BENCHMARK(float, 2)
+DEFINE_BENCHMARK(float, 4)
+DEFINE_BENCHMARK(float, 8)
+DEFINE_BENCHMARK(float, 16)
+DEFINE_BENCHMARK(float, 32)
+DEFINE_BENCHMARK(float, 64)
+DEFINE_BENCHMARK(float, 128)
+DEFINE_BENCHMARK(float, 256)
+DEFINE_BENCHMARK(float, 1024)
+DEFINE_BENCHMARK(float, 2048)
+DEFINE_BENCHMARK(float, 4096)
+
+#undef DEFINE_BENCHMARK
diff --git a/util/generic/benchmark/log2/metrics/main.py b/util/generic/benchmark/log2/metrics/main.py
index 26f6b57812..873f17664c 100644
--- a/util/generic/benchmark/log2/metrics/main.py
+++ b/util/generic/benchmark/log2/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/log2/log2', threads=8))
diff --git a/util/generic/benchmark/log2/metrics/ya.make b/util/generic/benchmark/log2/metrics/ya.make
index eb987e38d2..5afd7de200 100644
--- a/util/generic/benchmark/log2/metrics/ya.make
+++ b/util/generic/benchmark/log2/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/log2)
-
-END()
+
+END()
diff --git a/util/generic/benchmark/log2/ya.make b/util/generic/benchmark/log2/ya.make
index 45d751909e..eeef80523b 100644
--- a/util/generic/benchmark/log2/ya.make
+++ b/util/generic/benchmark/log2/ya.make
@@ -1,17 +1,17 @@
-OWNER(
- yazevnul
+OWNER(
+ yazevnul
g:util
-)
+)
SUBSCRIBER(g:util-subscribers)
-
+
Y_BENCHMARK()
-
-SRCS(
- main.cpp
-)
-
-PEERDIR(
+
+SRCS(
+ main.cpp
+)
+
+PEERDIR(
library/cpp/fast_log
-)
-
-END()
+)
+
+END()