[libcxx-commits] [libcxx] [libc++] Trim down associative container benchmark sizes (PR #212252)
Louis Dionne via libcxx-commits
libcxx-commits at lists.llvm.org
Mon Jul 27 06:44:03 PDT 2026
https://github.com/ldionne created https://github.com/llvm/llvm-project/pull/212252
Based on local measurements, the associative containers are by far the slowest benchmarks to run. While there is value in benchmarking small and large sizes, we can significantly cut down benchmark times by stripping down to only 2 sizes (from 4).
With this patch, the benchmarks go from 3124s to 1766s across the associative container benchmarks, which is -43% of their execution time, and corresponds to ~15% of the entire benchmark suite.
Towards #173032
>From cdd52001e3f72629b45e5ef79ddc16ada572beb4 Mon Sep 17 00:00:00 2001
From: Louis Dionne <ldionne.2 at gmail.com>
Date: Sat, 25 Jul 2026 07:36:01 -0400
Subject: [PATCH] [libc++] Reduce associative container benchmark size ladder
Based on local measurements, the associative containers are by far the
slowest benchmarks to run. While there is value in benchmarking small
and large sizes, we can significantly cut down benchmark times by stripping
down to only 2 sizes (from 4).
With this patch, the benchmarks go from 3124s to 1766s across the
associative container benchmarks, which is -43% of their execution
time, and corresponds to ~15% of the entire benchmark suite.
Towards #173032
---
.../containers/associative/associative_container_benchmarks.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/libcxx/test/benchmarks/containers/associative/associative_container_benchmarks.h b/libcxx/test/benchmarks/containers/associative/associative_container_benchmarks.h
index a55f187d2ac80..af403553c657d 100644
--- a/libcxx/test/benchmarks/containers/associative/associative_container_benchmarks.h
+++ b/libcxx/test/benchmarks/containers/associative/associative_container_benchmarks.h
@@ -63,10 +63,10 @@ void associative_container_benchmarks(std::string container) {
auto get_key = [](Value const& v) { return adapt_operations<Container>::key_from_value(v); };
auto bench = [&](std::string operation, auto f) {
- benchmark::RegisterBenchmark(container + "::" + operation, f)->Arg(0)->Arg(32)->Arg(1024)->Arg(8192);
+ benchmark::RegisterBenchmark(container + "::" + operation, f)->Arg(32)->Arg(8192);
};
auto bench_non_empty = [&](std::string operation, auto f) {
- benchmark::RegisterBenchmark(container + "::" + operation, f)->Arg(32)->Arg(1024)->Arg(8192);
+ benchmark::RegisterBenchmark(container + "::" + operation, f)->Arg(32)->Arg(8192);
};
static constexpr bool is_multi_key_container =
More information about the libcxx-commits
mailing list