[libcxx-commits] [libcxx] d0263f0 - [libc++] Remove complexity calculations from <filesystem> benchmark (#158290)
via libcxx-commits
libcxx-commits at lists.llvm.org
Mon Sep 15 05:48:17 PDT 2025
Author: Louis Dionne
Date: 2025-09-15T08:48:13-04:00
New Revision: d0263f07d1ad35223b017e660725c0a093e89e74
URL: https://github.com/llvm/llvm-project/commit/d0263f07d1ad35223b017e660725c0a093e89e74
DIFF: https://github.com/llvm/llvm-project/commit/d0263f07d1ad35223b017e660725c0a093e89e74.diff
LOG: [libc++] Remove complexity calculations from <filesystem> benchmark (#158290)
Our benchmarks are not really suited for complexity calculation, since
that doesn't translate nicely to any of the performance tracking tools
we have (including Lit).
Added:
Modified:
libcxx/test/benchmarks/filesystem.bench.cpp
libcxx/utils/parse-google-benchmark-results
Removed:
################################################################################
diff --git a/libcxx/test/benchmarks/filesystem.bench.cpp b/libcxx/test/benchmarks/filesystem.bench.cpp
index c058a5d41a150..61d14a453e72f 100644
--- a/libcxx/test/benchmarks/filesystem.bench.cpp
+++ b/libcxx/test/benchmarks/filesystem.bench.cpp
@@ -30,9 +30,8 @@ void BM_PathConstructString(benchmark::State& st, GenInputs gen) {
const path P(PP.native());
benchmark::DoNotOptimize(P.native().data());
}
- st.SetComplexityN(st.range(0));
}
-BENCHMARK_CAPTURE(BM_PathConstructString, large_string, getRandomStringInputs)->Range(8, TestNumInputs)->Complexity();
+BENCHMARK_CAPTURE(BM_PathConstructString, large_string, getRandomStringInputs)->Range(8, TestNumInputs);
template <class GenInputs>
void BM_PathConstructCStr(benchmark::State& st, GenInputs gen) {
@@ -66,7 +65,6 @@ void BM_PathConstructIter(benchmark::State& st, GenInputs gen) {
const path P(Start, End);
benchmark::DoNotOptimize(P.native().data());
}
- st.SetComplexityN(st.range(0));
}
template <class GenInputs>
void BM_PathConstructInputIter(benchmark::State& st, GenInputs gen) {
@@ -77,11 +75,9 @@ void BM_PathConstructForwardIter(benchmark::State& st, GenInputs gen) {
BM_PathConstructIter<forward_iterator>(st, gen);
}
BENCHMARK_CAPTURE(BM_PathConstructInputIter, large_string, getRandomStringInputs)
- ->Range(8, TestNumInputs)
- ->Complexity();
+ ->Range(8, TestNumInputs);
BENCHMARK_CAPTURE(BM_PathConstructForwardIter, large_string, getRandomStringInputs)
- ->Range(8, TestNumInputs)
- ->Complexity();
+ ->Range(8, TestNumInputs);
template <class GenInputs>
void BM_PathIterateMultipleTimes(benchmark::State& st, GenInputs gen) {
@@ -97,11 +93,9 @@ void BM_PathIterateMultipleTimes(benchmark::State& st, GenInputs gen) {
}
benchmark::ClobberMemory();
}
- st.SetComplexityN(st.range(0));
}
BENCHMARK_CAPTURE(BM_PathIterateMultipleTimes, iterate_elements, getRandomStringInputs)
- ->Range(8, TestNumInputs)
- ->Complexity();
+ ->Range(8, TestNumInputs);
template <class GenInputs>
void BM_PathIterateOnce(benchmark::State& st, GenInputs gen) {
@@ -118,9 +112,8 @@ void BM_PathIterateOnce(benchmark::State& st, GenInputs gen) {
}
benchmark::ClobberMemory();
}
- st.SetComplexityN(st.range(0));
}
-BENCHMARK_CAPTURE(BM_PathIterateOnce, iterate_elements, getRandomStringInputs)->Range(8, TestNumInputs)->Complexity();
+BENCHMARK_CAPTURE(BM_PathIterateOnce, iterate_elements, getRandomStringInputs)->Range(8, TestNumInputs);
template <class GenInputs>
void BM_PathIterateOnceBackwards(benchmark::State& st, GenInputs gen) {
@@ -160,16 +153,13 @@ void BM_LexicallyNormal(benchmark::State& st, GenInput gen, size_t PathLen) {
while (st.KeepRunning()) {
benchmark::DoNotOptimize(In.lexically_normal());
}
- st.SetComplexityN(st.range(0));
}
BENCHMARK_CAPTURE(BM_LexicallyNormal, small_path, getRandomPaths, /*PathLen*/ 5)
->RangeMultiplier(2)
- ->Range(2, 256)
- ->Complexity();
+ ->Range(2, 256);
BENCHMARK_CAPTURE(BM_LexicallyNormal, large_path, getRandomPaths, /*PathLen*/ 32)
->RangeMultiplier(2)
- ->Range(2, 256)
- ->Complexity();
+ ->Range(2, 256);
template <class GenInput>
void BM_LexicallyRelative(benchmark::State& st, GenInput gen, size_t PathLen) {
@@ -180,15 +170,12 @@ void BM_LexicallyRelative(benchmark::State& st, GenInput gen, size_t PathLen) {
for (auto _ : st) {
benchmark::DoNotOptimize(TargetPath.lexically_relative(BasePath));
}
- st.SetComplexityN(st.range(0));
}
BENCHMARK_CAPTURE(BM_LexicallyRelative, small_path, getRandomPaths, /*PathLen*/ 5)
->RangeMultiplier(2)
- ->Range(2, 256)
- ->Complexity();
+ ->Range(2, 256);
BENCHMARK_CAPTURE(BM_LexicallyRelative, large_path, getRandomPaths, /*PathLen*/ 32)
->RangeMultiplier(2)
- ->Range(2, 256)
- ->Complexity();
+ ->Range(2, 256);
BENCHMARK_MAIN();
diff --git a/libcxx/utils/parse-google-benchmark-results b/libcxx/utils/parse-google-benchmark-results
index 280c8045db6c9..86d59bb522a4d 100755
--- a/libcxx/utils/parse-google-benchmark-results
+++ b/libcxx/utils/parse-google-benchmark-results
@@ -26,6 +26,8 @@ def main(argv):
for file in args.filename:
js = json.load(file)
for bm in js['benchmarks']:
+ if args.timing not in bm:
+ raise RuntimeError(f'Benchmark does not contain key for {args.timing}: {bm}')
row = [bm['name'], bm[args.timing]]
rows.append(row)
More information about the libcxx-commits
mailing list