Skip to content

Commit a6093d3

Browse files
authored
[libc++] Explicitly mention vector_bool in the name of benchmarks (#127313)
We have some benchmarks that were benchmarking very specific functionality, namely the optimizations in vector<bool>::iterator. Call this out in the benchmarks by renaming them appropriately. In the future we will also increase the coverage of these benchmarks to test other containers.
1 parent 42ff31a commit a6093d3

File tree

2 files changed

+14
-14
lines changed

2 files changed

+14
-14
lines changed

libcxx/test/benchmarks/algorithms/fill.bench.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,40 +12,40 @@
1212
#include <benchmark/benchmark.h>
1313
#include <vector>
1414

15-
static void bm_fill_n(benchmark::State& state) {
15+
static void bm_fill_n_vector_bool(benchmark::State& state) {
1616
std::vector<bool> vec1(state.range());
1717
for (auto _ : state) {
1818
benchmark::DoNotOptimize(vec1);
1919
benchmark::DoNotOptimize(std::fill_n(vec1.begin(), vec1.size(), false));
2020
}
2121
}
22-
BENCHMARK(bm_fill_n)->DenseRange(1, 8)->Range(16, 1 << 20);
22+
BENCHMARK(bm_fill_n_vector_bool)->DenseRange(1, 8)->Range(16, 1 << 20);
2323

24-
static void bm_ranges_fill_n(benchmark::State& state) {
24+
static void bm_ranges_fill_n_vector_bool(benchmark::State& state) {
2525
std::vector<bool> vec1(state.range());
2626
for (auto _ : state) {
2727
benchmark::DoNotOptimize(vec1);
2828
benchmark::DoNotOptimize(std::ranges::fill_n(vec1.begin(), vec1.size(), false));
2929
}
3030
}
31-
BENCHMARK(bm_ranges_fill_n)->DenseRange(1, 8)->Range(16, 1 << 20);
31+
BENCHMARK(bm_ranges_fill_n_vector_bool)->DenseRange(1, 8)->Range(16, 1 << 20);
3232

33-
static void bm_fill(benchmark::State& state) {
33+
static void bm_fill_vector_bool(benchmark::State& state) {
3434
std::vector<bool> vec1(state.range());
3535
for (auto _ : state) {
3636
benchmark::DoNotOptimize(vec1);
3737
std::fill(vec1.begin(), vec1.end(), false);
3838
}
3939
}
40-
BENCHMARK(bm_fill)->DenseRange(1, 8)->Range(16, 1 << 20);
40+
BENCHMARK(bm_fill_vector_bool)->DenseRange(1, 8)->Range(16, 1 << 20);
4141

42-
static void bm_ranges_fill(benchmark::State& state) {
42+
static void bm_ranges_fill_vector_bool(benchmark::State& state) {
4343
std::vector<bool> vec1(state.range());
4444
for (auto _ : state) {
4545
benchmark::DoNotOptimize(vec1);
4646
benchmark::DoNotOptimize(std::ranges::fill(vec1, false));
4747
}
4848
}
49-
BENCHMARK(bm_ranges_fill)->DenseRange(1, 8)->Range(16, 1 << 20);
49+
BENCHMARK(bm_ranges_fill_vector_bool)->DenseRange(1, 8)->Range(16, 1 << 20);
5050

5151
BENCHMARK_MAIN();

libcxx/test/benchmarks/algorithms/ranges_contains.bench.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
#include "test_iterators.h"
1717

18-
static void bm_contains_char(benchmark::State& state) {
18+
static void bm_contains_vector_char(benchmark::State& state) {
1919
std::vector<char> a(state.range(), 'a');
2020

2121
for (auto _ : state) {
@@ -24,9 +24,9 @@ static void bm_contains_char(benchmark::State& state) {
2424
benchmark::DoNotOptimize(std::ranges::contains(a.begin(), a.end(), 'B'));
2525
}
2626
}
27-
BENCHMARK(bm_contains_char)->RangeMultiplier(16)->Range(16, 16 << 20);
27+
BENCHMARK(bm_contains_vector_char)->RangeMultiplier(16)->Range(16, 16 << 20);
2828

29-
static void bm_contains_int(benchmark::State& state) {
29+
static void bm_contains_vector_int(benchmark::State& state) {
3030
std::vector<int> a(state.range(), 1);
3131

3232
for (auto _ : state) {
@@ -35,9 +35,9 @@ static void bm_contains_int(benchmark::State& state) {
3535
benchmark::DoNotOptimize(std::ranges::contains(a.begin(), a.end(), 2));
3636
}
3737
}
38-
BENCHMARK(bm_contains_int)->RangeMultiplier(16)->Range(16, 16 << 20);
38+
BENCHMARK(bm_contains_vector_int)->RangeMultiplier(16)->Range(16, 16 << 20);
3939

40-
static void bm_contains_bool(benchmark::State& state) {
40+
static void bm_contains_vector_bool(benchmark::State& state) {
4141
std::vector<bool> a(state.range(), true);
4242

4343
for (auto _ : state) {
@@ -46,6 +46,6 @@ static void bm_contains_bool(benchmark::State& state) {
4646
benchmark::DoNotOptimize(std::ranges::contains(a.begin(), a.end(), false));
4747
}
4848
}
49-
BENCHMARK(bm_contains_bool)->RangeMultiplier(16)->Range(16, 16 << 20);
49+
BENCHMARK(bm_contains_vector_bool)->RangeMultiplier(16)->Range(16, 16 << 20);
5050

5151
BENCHMARK_MAIN();

0 commit comments

Comments
 (0)