xref: /openbsd-src/gnu/llvm/libcxx/benchmarks/deque.bench.cpp (revision 4bdff4bed0e3d54e55670334c7d0077db4170f86)
1*46035553Spatrick //===----------------------------------------------------------------------===//
2*46035553Spatrick //
3*46035553Spatrick // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4*46035553Spatrick // See https://llvm.org/LICENSE.txt for license information.
5*46035553Spatrick // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6*46035553Spatrick //
7*46035553Spatrick //===----------------------------------------------------------------------===//
8*46035553Spatrick 
9*46035553Spatrick #include <deque>
10*46035553Spatrick 
11*46035553Spatrick #include "benchmark/benchmark.h"
12*46035553Spatrick 
13*46035553Spatrick #include "ContainerBenchmarks.h"
14*46035553Spatrick #include "GenerateInput.h"
15*46035553Spatrick 
16*46035553Spatrick using namespace ContainerBenchmarks;
17*46035553Spatrick 
18*46035553Spatrick constexpr std::size_t TestNumInputs = 1024;
19*46035553Spatrick 
20*46035553Spatrick BENCHMARK_CAPTURE(BM_ConstructSize,
21*46035553Spatrick     deque_byte,
22*46035553Spatrick     std::deque<unsigned char>{})->Arg(5140480);
23*46035553Spatrick 
24*46035553Spatrick BENCHMARK_CAPTURE(BM_ConstructSizeValue,
25*46035553Spatrick     deque_byte,
26*46035553Spatrick     std::deque<unsigned char>{}, 0)->Arg(5140480);
27*46035553Spatrick 
28*46035553Spatrick BENCHMARK_CAPTURE(BM_ConstructIterIter,
29*46035553Spatrick   deque_char,
30*46035553Spatrick   std::deque<char>{},
31*46035553Spatrick   getRandomIntegerInputs<char>)->Arg(TestNumInputs);
32*46035553Spatrick 
33*46035553Spatrick BENCHMARK_CAPTURE(BM_ConstructIterIter,
34*46035553Spatrick   deque_size_t,
35*46035553Spatrick   std::deque<size_t>{},
36*46035553Spatrick   getRandomIntegerInputs<size_t>)->Arg(TestNumInputs);
37*46035553Spatrick 
38*46035553Spatrick BENCHMARK_CAPTURE(BM_ConstructIterIter,
39*46035553Spatrick   deque_string,
40*46035553Spatrick   std::deque<std::string>{},
41*46035553Spatrick   getRandomStringInputs)->Arg(TestNumInputs);
42*46035553Spatrick 
43*46035553Spatrick 
44*46035553Spatrick 
45*46035553Spatrick 
46*46035553Spatrick BENCHMARK_MAIN();
47