[libcxx-commits] [libcxx] [libc++] Fix broke unique and unique_copy benchmarks (PR #158287)

Louis Dionne via libcxx-commits libcxx-commits at lists.llvm.org
Fri Sep 12 05:56:27 PDT 2025


https://github.com/ldionne created https://github.com/llvm/llvm-project/pull/158287

These benchmarks have an assumption that the container size is divisible by 4 because of how we populate their content, which wasn't satisfied.

>From ee083f13c6d6619d4ebff5d1ba4df76827201280 Mon Sep 17 00:00:00 2001
From: Louis Dionne <ldionne.2 at gmail.com>
Date: Fri, 12 Sep 2025 08:55:14 -0400
Subject: [PATCH] [libc++] Fix broke unique and unique_copy benchmarks

These benchmarks have an assumption that the container size is
divisible by 4 because of how we populate their content, which
wasn't satisfied.
---
 libcxx/test/benchmarks/algorithms/modifying/unique.bench.cpp  | 4 ++--
 .../benchmarks/algorithms/modifying/unique_copy.bench.cpp     | 3 ++-
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/libcxx/test/benchmarks/algorithms/modifying/unique.bench.cpp b/libcxx/test/benchmarks/algorithms/modifying/unique.bench.cpp
index c0aee942eef64..e3ac50187ef4b 100644
--- a/libcxx/test/benchmarks/algorithms/modifying/unique.bench.cpp
+++ b/libcxx/test/benchmarks/algorithms/modifying/unique.bench.cpp
@@ -76,7 +76,7 @@ int main(int argc, char** argv) {
             }
           })
           ->Arg(32)
-          ->Arg(50) // non power-of-two
+          ->Arg(52) // non power-of-two
           ->Arg(1024)
           ->Arg(8192);
     };
@@ -143,7 +143,7 @@ int main(int argc, char** argv) {
             }
           })
           ->Arg(32)
-          ->Arg(50) // non power-of-two
+          ->Arg(52) // non power-of-two
           ->Arg(1024)
           ->Arg(8192);
     };
diff --git a/libcxx/test/benchmarks/algorithms/modifying/unique_copy.bench.cpp b/libcxx/test/benchmarks/algorithms/modifying/unique_copy.bench.cpp
index 45b52dd23b695..1885b53e51413 100644
--- a/libcxx/test/benchmarks/algorithms/modifying/unique_copy.bench.cpp
+++ b/libcxx/test/benchmarks/algorithms/modifying/unique_copy.bench.cpp
@@ -61,6 +61,7 @@ int main(int argc, char** argv) {
             }
           })
           ->Arg(32)
+          ->Arg(52) // non power-of-two
           ->Arg(1024)
           ->Arg(8192);
     };
@@ -115,7 +116,7 @@ int main(int argc, char** argv) {
             }
           })
           ->Arg(32)
-          ->Arg(50) // non power-of-two
+          ->Arg(52) // non power-of-two
           ->Arg(1024)
           ->Arg(8192);
     };



More information about the libcxx-commits mailing list