[flang][runtime] Make defined formatted I/O process format elementally (#74150)
[llvm-project.git] / libcxx / benchmarks / monotonic_buffer.bench.cpp
blob39bb853ccba5dd1d9968312031c55a0ed3cb83cb
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 //===----------------------------------------------------------------------===//
9 #include <list>
10 #include <memory_resource>
12 #include "benchmark/benchmark.h"
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(1);
21 benchmark::DoNotOptimize(l);
23 resource.release();
26 BENCHMARK(bm_list)->Range(1, 2048);
28 BENCHMARK_MAIN();