[libcxx-commits] [libcxx] [libc++] Give proper names to a few benchmarks (PR #183333)
via libcxx-commits
libcxx-commits at lists.llvm.org
Wed Feb 25 08:37:07 PST 2026
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-libcxx
Author: Louis Dionne (ldionne)
<details>
<summary>Changes</summary>
---
Full diff: https://github.com/llvm/llvm-project/pull/183333.diff
3 Files Affected:
- (modified) libcxx/test/benchmarks/numeric/gcd.bench.cpp (+3-3)
- (modified) libcxx/test/benchmarks/streams/getline.bench.cpp (+1-1)
- (modified) libcxx/test/benchmarks/streams/ofstream.bench.cpp (+1-1)
``````````diff
diff --git a/libcxx/test/benchmarks/numeric/gcd.bench.cpp b/libcxx/test/benchmarks/numeric/gcd.bench.cpp
index ca5fed59463a2..008968eeda90a 100644
--- a/libcxx/test/benchmarks/numeric/gcd.bench.cpp
+++ b/libcxx/test/benchmarks/numeric/gcd.bench.cpp
@@ -30,7 +30,7 @@ static void bm_gcd_random(benchmark::State& state) {
for (auto v1 : data)
benchmark::DoNotOptimize(std::gcd(v0, v1));
}
-BENCHMARK(bm_gcd_random);
+BENCHMARK(bm_gcd_random)->Name("std::gcd() (random numbers)");
static void bm_gcd_trivial(benchmark::State& state) {
int lhs = ~static_cast<int>(0), rhs = 1;
@@ -40,7 +40,7 @@ static void bm_gcd_trivial(benchmark::State& state) {
benchmark::DoNotOptimize(std::gcd(lhs, rhs));
}
}
-BENCHMARK(bm_gcd_trivial);
+BENCHMARK(bm_gcd_trivial)->Name("std::gcd() (trivial inputs)");
static void bm_gcd_complex(benchmark::State& state) {
long long lhs = 2971215073;
@@ -51,6 +51,6 @@ static void bm_gcd_complex(benchmark::State& state) {
benchmark::DoNotOptimize(std::gcd(lhs, rhs));
}
}
-BENCHMARK(bm_gcd_complex);
+BENCHMARK(bm_gcd_complex)->Name("std::gcd() (adversary inputs)");
BENCHMARK_MAIN();
diff --git a/libcxx/test/benchmarks/streams/getline.bench.cpp b/libcxx/test/benchmarks/streams/getline.bench.cpp
index 5ccefce876224..74fb4d12ae971 100644
--- a/libcxx/test/benchmarks/streams/getline.bench.cpp
+++ b/libcxx/test/benchmarks/streams/getline.bench.cpp
@@ -29,6 +29,6 @@ void BM_getline_string(benchmark::State& state) {
}
}
-BENCHMARK(BM_getline_string);
+BENCHMARK(BM_getline_string)->Name("std::getline(std::istringstream, std::string)");
BENCHMARK_MAIN();
diff --git a/libcxx/test/benchmarks/streams/ofstream.bench.cpp b/libcxx/test/benchmarks/streams/ofstream.bench.cpp
index 60606a9d67e2f..eb50a41ed4ed4 100644
--- a/libcxx/test/benchmarks/streams/ofstream.bench.cpp
+++ b/libcxx/test/benchmarks/streams/ofstream.bench.cpp
@@ -20,6 +20,6 @@ static void bm_write(benchmark::State& state) {
for (auto _ : state)
stream.write(buffer.data(), buffer.size());
}
-BENCHMARK(bm_write);
+BENCHMARK(bm_write)->Name("std::ofstream::write(char*, size)");
BENCHMARK_MAIN();
``````````
</details>
https://github.com/llvm/llvm-project/pull/183333
More information about the libcxx-commits
mailing list