diff options
author | robot-piglet <robot-piglet@yandex-team.com> | 2024-10-21 16:49:40 +0300 |
---|---|---|
committer | robot-piglet <robot-piglet@yandex-team.com> | 2024-10-21 17:17:10 +0300 |
commit | f00daf17b15d1c30b4095c8dbe264815b27ca37a (patch) | |
tree | 42a9b20765ce8d2127f0b95362b24074bc09cb65 /library/cpp | |
parent | 6ad12991c044e3aba7d8d870c9f21690d850ab8c (diff) | |
download | ydb-f00daf17b15d1c30b4095c8dbe264815b27ca37a.tar.gz |
Intermediate changes
commit_hash:190ff2d3da523521b04ad0065bc2c0615d719674
Diffstat (limited to 'library/cpp')
-rw-r--r-- | library/cpp/pop_count/benchmark/main.cpp | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/library/cpp/pop_count/benchmark/main.cpp b/library/cpp/pop_count/benchmark/main.cpp index 41ea3c91cc..1af2d157b6 100644 --- a/library/cpp/pop_count/benchmark/main.cpp +++ b/library/cpp/pop_count/benchmark/main.cpp @@ -5,6 +5,8 @@ #include <library/cpp/pop_count/popcount.h> #include <library/cpp/testing/benchmark/bench.h> +#include <bit> + template <class F, class I> inline void DoRun(F&& f, I&& i) { const ui64 n = i.Iterations(); @@ -21,6 +23,13 @@ Y_CPU_BENCHMARK(PopCount_8, iface) { iface); } +Y_CPU_BENCHMARK(std_popcount_8, iface) { + DoRun([](ui8 x) { + return std::popcount<ui8>(x); + }, + iface); +} + Y_CPU_BENCHMARK(PopCount_16, iface) { DoRun([](ui16 x) { return PopCount<ui16>(x); @@ -28,6 +37,13 @@ Y_CPU_BENCHMARK(PopCount_16, iface) { iface); } +Y_CPU_BENCHMARK(std_popcount_16, iface) { + DoRun([](ui16 x) { + return std::popcount<ui16>(x); + }, + iface); +} + Y_CPU_BENCHMARK(PopCount_32, iface) { DoRun([](ui32 x) { return PopCount<ui32>(x); @@ -35,6 +51,13 @@ Y_CPU_BENCHMARK(PopCount_32, iface) { iface); } +Y_CPU_BENCHMARK(std_popcount_32, iface) { + DoRun([](ui32 x) { + return std::popcount<ui32>(x); + }, + iface); +} + Y_CPU_BENCHMARK(PopCount_64, iface) { DoRun([](ui64 x) { return PopCount<ui64>(x); @@ -42,6 +65,13 @@ Y_CPU_BENCHMARK(PopCount_64, iface) { iface); } +Y_CPU_BENCHMARK(std_popcount_64, iface) { + DoRun([](ui64 x) { + return std::popcount<ui64>(x); + }, + iface); +} + #if !defined(_MSC_VER) Y_CPU_BENCHMARK(BUILTIN_64, iface) { DoRun([](ui64 x) { |