aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/pop_count/benchmark
diff options
context:
space:
mode:
authorAnton Samokhvalov <pg83@yandex.ru>2022-02-10 16:45:17 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:45:17 +0300
commitd3a398281c6fd1d3672036cb2d63f842d2cb28c5 (patch)
treedd4bd3ca0f36b817e96812825ffaf10d645803f2 /library/cpp/pop_count/benchmark
parent72cb13b4aff9bc9cf22e49251bc8fd143f82538f (diff)
downloadydb-d3a398281c6fd1d3672036cb2d63f842d2cb28c5.tar.gz
Restoring authorship annotation for Anton Samokhvalov <pg83@yandex.ru>. Commit 2 of 2.
Diffstat (limited to 'library/cpp/pop_count/benchmark')
-rw-r--r--library/cpp/pop_count/benchmark/main.cpp94
-rw-r--r--library/cpp/pop_count/benchmark/ya.make20
2 files changed, 57 insertions, 57 deletions
diff --git a/library/cpp/pop_count/benchmark/main.cpp b/library/cpp/pop_count/benchmark/main.cpp
index 13720beb18..41ea3c91cc 100644
--- a/library/cpp/pop_count/benchmark/main.cpp
+++ b/library/cpp/pop_count/benchmark/main.cpp
@@ -1,52 +1,52 @@
-#include <util/stream/output.h>
-#include <util/datetime/cputimer.h>
+#include <util/stream/output.h>
+#include <util/datetime/cputimer.h>
#include <util/system/type_name.h>
-
+
#include <library/cpp/pop_count/popcount.h>
#include <library/cpp/testing/benchmark/bench.h>
-
-template <class F, class I>
-inline void DoRun(F&& f, I&& i) {
- const ui64 n = i.Iterations();
-
+
+template <class F, class I>
+inline void DoRun(F&& f, I&& i) {
+ const ui64 n = i.Iterations();
+
for (ui64 j = 0; j < n; ++j) {
Y_DO_NOT_OPTIMIZE_AWAY(f(j * (ui64)123456 + (ui64)1));
- }
-}
-
-Y_CPU_BENCHMARK(PopCount_8, iface) {
- DoRun([](ui8 x) {
- return PopCount<ui8>(x);
- },
- iface);
-}
-
-Y_CPU_BENCHMARK(PopCount_16, iface) {
- DoRun([](ui16 x) {
- return PopCount<ui16>(x);
- },
- iface);
-}
-
-Y_CPU_BENCHMARK(PopCount_32, iface) {
- DoRun([](ui32 x) {
- return PopCount<ui32>(x);
- },
- iface);
-}
-
-Y_CPU_BENCHMARK(PopCount_64, iface) {
- DoRun([](ui64 x) {
- return PopCount<ui64>(x);
- },
- iface);
-}
-
-#if !defined(_MSC_VER)
-Y_CPU_BENCHMARK(BUILTIN_64, iface) {
- DoRun([](ui64 x) {
- return __builtin_popcountll(x);
- },
- iface);
-}
-#endif
+ }
+}
+
+Y_CPU_BENCHMARK(PopCount_8, iface) {
+ DoRun([](ui8 x) {
+ return PopCount<ui8>(x);
+ },
+ iface);
+}
+
+Y_CPU_BENCHMARK(PopCount_16, iface) {
+ DoRun([](ui16 x) {
+ return PopCount<ui16>(x);
+ },
+ iface);
+}
+
+Y_CPU_BENCHMARK(PopCount_32, iface) {
+ DoRun([](ui32 x) {
+ return PopCount<ui32>(x);
+ },
+ iface);
+}
+
+Y_CPU_BENCHMARK(PopCount_64, iface) {
+ DoRun([](ui64 x) {
+ return PopCount<ui64>(x);
+ },
+ iface);
+}
+
+#if !defined(_MSC_VER)
+Y_CPU_BENCHMARK(BUILTIN_64, iface) {
+ DoRun([](ui64 x) {
+ return __builtin_popcountll(x);
+ },
+ iface);
+}
+#endif
diff --git a/library/cpp/pop_count/benchmark/ya.make b/library/cpp/pop_count/benchmark/ya.make
index 02b61bdeca..7fb54a519a 100644
--- a/library/cpp/pop_count/benchmark/ya.make
+++ b/library/cpp/pop_count/benchmark/ya.make
@@ -1,14 +1,14 @@
OWNER(g:util)
Y_BENCHMARK()
-
-PEERDIR(
- util/draft
+
+PEERDIR(
+ util/draft
library/cpp/pop_count
-)
-
-SRCS(
- main.cpp
-)
-
-END()
+)
+
+SRCS(
+ main.cpp
+)
+
+END()