1 //===----------------------------------------------------------------------===// 2 // 3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4 // See https://llvm.org/LICENSE.txt for license information. 5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6 // 7 //===----------------------------------------------------------------------===// 8 9 // UNSUPPORTED: c++03, c++11, c++14 10 11 #include <list> 12 #include <memory_resource> 13 14 #include "benchmark/benchmark.h" 15 bm_list(benchmark::State & state)16static void bm_list(benchmark::State& state) { 17 char buffer[16384]; 18 std::pmr::monotonic_buffer_resource resource(buffer, sizeof(buffer)); 19 for (auto _ : state) { 20 std::pmr::list<int> l(&resource); 21 for (int64_t i = 0; i != state.range(); ++i) { 22 l.push_back(1); 23 benchmark::DoNotOptimize(l); 24 } 25 resource.release(); 26 } 27 } 28 BENCHMARK(bm_list)->Range(1, 2048); 29 30 BENCHMARK_MAIN(); 31