Skip to content

[libc++] Explicitly mention vector_bool in the name of benchmarks #127313

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 15, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions libcxx/test/benchmarks/algorithms/fill.bench.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,40 +12,40 @@
#include <benchmark/benchmark.h>
#include <vector>

static void bm_fill_n(benchmark::State& state) {
static void bm_fill_n_vector_bool(benchmark::State& state) {
std::vector<bool> vec1(state.range());
for (auto _ : state) {
benchmark::DoNotOptimize(vec1);
benchmark::DoNotOptimize(std::fill_n(vec1.begin(), vec1.size(), false));
}
}
BENCHMARK(bm_fill_n)->DenseRange(1, 8)->Range(16, 1 << 20);
BENCHMARK(bm_fill_n_vector_bool)->DenseRange(1, 8)->Range(16, 1 << 20);

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

static void bm_fill(benchmark::State& state) {
static void bm_fill_vector_bool(benchmark::State& state) {
std::vector<bool> vec1(state.range());
for (auto _ : state) {
benchmark::DoNotOptimize(vec1);
std::fill(vec1.begin(), vec1.end(), false);
}
}
BENCHMARK(bm_fill)->DenseRange(1, 8)->Range(16, 1 << 20);
BENCHMARK(bm_fill_vector_bool)->DenseRange(1, 8)->Range(16, 1 << 20);

static void bm_ranges_fill(benchmark::State& state) {
static void bm_ranges_fill_vector_bool(benchmark::State& state) {
std::vector<bool> vec1(state.range());
for (auto _ : state) {
benchmark::DoNotOptimize(vec1);
benchmark::DoNotOptimize(std::ranges::fill(vec1, false));
}
}
BENCHMARK(bm_ranges_fill)->DenseRange(1, 8)->Range(16, 1 << 20);
BENCHMARK(bm_ranges_fill_vector_bool)->DenseRange(1, 8)->Range(16, 1 << 20);

BENCHMARK_MAIN();
12 changes: 6 additions & 6 deletions libcxx/test/benchmarks/algorithms/ranges_contains.bench.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

#include "test_iterators.h"

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

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

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

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

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

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

BENCHMARK_MAIN();