[libcxx-commits] [libcxx] [libc++] Remove unnecessary container constructions in setup code (PR #216141)

Nikolas Klauser via libcxx-commits libcxx-commits at lists.llvm.org
Fri Aug 14 00:49:05 PDT 2026


================
@@ -513,24 +514,25 @@ void associative_container_benchmarks(std::string container) {
   });
 
   bench_non_empty("insert(iterator, iterator) (half new keys)", [=](auto& st) TEST_ALIGN_BENCHMARK {
-    const std::size_t size = st.range(0);
-    std::vector<Value> in  = make_value_types(generate_unique_keys(size));
+    const std::size_t size   = st.range(0);
+    std::vector<Value> large = make_value_types(generate_unique_keys(size));
 
     // Populate a container that already contains half the elements we'll try inserting,
     // that's what our container will start with.
     std::vector<Value> small;
     for (std::size_t i = 0; i != size / 2; ++i) {
-      small.push_back(in.at(i * 2));
+      small.push_back(large.at(i * 2));
     }
     Container c(small.begin(), small.end());
----------------
philnik777 wrote:

Same here.

https://github.com/llvm/llvm-project/pull/216141


More information about the libcxx-commits mailing list