From 37632992efde080a1c72fe9bfa95087c9cff5737 Mon Sep 17 00:00:00 2001 From: Samuel Benzaquen Date: Tue, 23 Oct 2018 14:49:27 +0000 Subject: [PATCH] Add benchmark for std::set. Summary: Benchmarks for construct, find, insert and iterate, with sequential and random ordered inputs. It also improves the cartesian product benchmark header to allow for runtime values to be specified in the product. Reviewers: EricWF Subscribers: christof, ldionne, libcxx-commits Differential Revision: https://reviews.llvm.org/D53523 llvm-svn: 345035 --- libcxx/benchmarks/CartesianBenchmarks.hpp | 83 +++++++--- libcxx/benchmarks/ordered_set.bench.cpp | 249 ++++++++++++++++++++++++++++++ 2 files changed, 312 insertions(+), 20 deletions(-) create mode 100644 libcxx/benchmarks/ordered_set.bench.cpp diff --git a/libcxx/benchmarks/CartesianBenchmarks.hpp b/libcxx/benchmarks/CartesianBenchmarks.hpp index 7cd13a0..88a994c 100644 --- a/libcxx/benchmarks/CartesianBenchmarks.hpp +++ b/libcxx/benchmarks/CartesianBenchmarks.hpp @@ -11,6 +11,7 @@ #include #include #include +#include #include "benchmark/benchmark.h" #include "test_macros.h" @@ -27,25 +28,55 @@ constexpr auto makeEnumValueTuple(std::index_sequence) { return std::make_tuple(EnumValue{}...); } -template -static auto skip(int) -> decltype(T::skip()) { - return T::skip(); +template +static auto skip(const B& Bench, int) -> decltype(Bench.skip()) { + return Bench.skip(); } -template -static bool skip(char) { +template +static auto skip(const B& Bench, char) { return false; } -template