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 | #include <list> |
10 | #include <memory_resource> |
11 | |
12 | #include "benchmark/benchmark.h" |
13 | |
14 | static void bm_list(benchmark::State& state) { |
15 | char buffer[16384]; |
16 | std::pmr::monotonic_buffer_resource resource(buffer, sizeof(buffer)); |
17 | for (auto _ : state) { |
18 | std::pmr::list<int> l(&resource); |
19 | for (int64_t i = 0; i != state.range(); ++i) { |
20 | l.push_back(x: 1); |
21 | benchmark::DoNotOptimize(value&: l); |
22 | } |
23 | resource.release(); |
24 | } |
25 | } |
26 | BENCHMARK(bm_list)->Range(start: 1, limit: 2048); |
27 | |
28 | BENCHMARK_MAIN(); |
29 |