[libcxx-commits] [libcxx] [libc++] Fix append_range and prepend_range benchmarks (PR #216038)

via libcxx-commits libcxx-commits at lists.llvm.org
Thu Aug 13 05:51:28 PDT 2026


llvmorg-github-actions[bot] wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-libcxx

Author: Louis Dionne (ldionne)

<details>
<summary>Changes</summary>

They were using clear(), which keeps the storage around, instead of starting over from an empty container.

Fixes #<!-- -->209499

---
Full diff: https://github.com/llvm/llvm-project/pull/216038.diff


1 Files Affected:

- (modified) libcxx/test/benchmarks/containers/sequence/sequence_container_benchmarks.h (+2-2) 


``````````diff
diff --git a/libcxx/test/benchmarks/containers/sequence/sequence_container_benchmarks.h b/libcxx/test/benchmarks/containers/sequence/sequence_container_benchmarks.h
index ff7b7fe2af018..68cd74a9ca782 100644
--- a/libcxx/test/benchmarks/containers/sequence/sequence_container_benchmarks.h
+++ b/libcxx/test/benchmarks/containers/sequence/sequence_container_benchmarks.h
@@ -413,7 +413,7 @@ void sequence_container_benchmarks(std::string container) {
           DoNotOptimizeData(c);
 
           state.PauseTiming();
-          c.clear();
+          c = Container();
           state.ResumeTiming();
         }
       });
@@ -440,7 +440,7 @@ void sequence_container_benchmarks(std::string container) {
           DoNotOptimizeData(c);
 
           state.PauseTiming();
-          c.clear();
+          c = Container();
           state.ResumeTiming();
         }
       });

``````````

</details>


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


More information about the libcxx-commits mailing list