diff options
| -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 41ea3c91cc5..1af2d157b61 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) { |
