summaryrefslogtreecommitdiffstats
path: root/libcxx/benchmarks/ContainerBenchmarks.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'libcxx/benchmarks/ContainerBenchmarks.hpp')
-rw-r--r--libcxx/benchmarks/ContainerBenchmarks.hpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/libcxx/benchmarks/ContainerBenchmarks.hpp b/libcxx/benchmarks/ContainerBenchmarks.hpp
index 509e3d23ed9..648617a9cd2 100644
--- a/libcxx/benchmarks/ContainerBenchmarks.hpp
+++ b/libcxx/benchmarks/ContainerBenchmarks.hpp
@@ -7,6 +7,23 @@
namespace ContainerBenchmarks {
+template <class Container>
+void BM_ConstructSize(benchmark::State& st, Container) {
+ auto size = st.range(0);
+ for (auto _ : st) {
+ Container c(size);
+ benchmark::DoNotOptimize(c.data());
+ }
+}
+
+template <class Container>
+void BM_ConstructSizeValue(benchmark::State& st, Container, typename Container::value_type const& val) {
+ const auto size = st.range(0);
+ for (auto _ : st) {
+ Container c(size, val);
+ benchmark::DoNotOptimize(c.data());
+ }
+}
template <class Container, class GenInputs>
void BM_ConstructIterIter(benchmark::State& st, Container, GenInputs gen) {
OpenPOWER on IntegriCloud