]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/boost/libs/math/reporting/performance/color_tables_performance.cpp
update ceph source to reef 18.1.2
[ceph.git] / ceph / src / boost / libs / math / reporting / performance / color_tables_performance.cpp
diff --git a/ceph/src/boost/libs/math/reporting/performance/color_tables_performance.cpp b/ceph/src/boost/libs/math/reporting/performance/color_tables_performance.cpp
new file mode 100644 (file)
index 0000000..e57d438
--- /dev/null
@@ -0,0 +1,30 @@
+//  (C) Copyright Matt Borland 2022.
+//  Use, modification and distribution are subject to the
+//  Boost Software License, Version 1.0. (See accompanying file
+//  LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#include <array>
+#include <random>
+#include <limits>
+#include <boost/math/tools/color_maps.hpp>
+#include <benchmark/benchmark.h>
+
+template <typename Real>
+void viridis_bm(benchmark::State& state)
+{
+    std::random_device rd;
+    std::mt19937_64 gen(rd());
+    std::uniform_real_distribution<Real> dist(0, 0.125);
+    Real x = dist(gen);
+    for (auto _ : state)
+    {
+        benchmark::DoNotOptimize(boost::math::tools::viridis(x));
+        x += std::numeric_limits<Real>::epsilon();
+    }
+}
+
+BENCHMARK_TEMPLATE(viridis_bm, float);
+BENCHMARK_TEMPLATE(viridis_bm, double);
+
+
+BENCHMARK_MAIN();