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

via libcxx-commits libcxx-commits at lists.llvm.org
Thu Aug 13 08:16:26 PDT 2026


Author: Louis Dionne
Date: 2026-08-13T11:16:21-04:00
New Revision: 473c263df9551282d78c0d1b8b85dbc7b04219fa

URL: https://github.com/llvm/llvm-project/commit/473c263df9551282d78c0d1b8b85dbc7b04219fa
DIFF: https://github.com/llvm/llvm-project/commit/473c263df9551282d78c0d1b8b85dbc7b04219fa.diff

LOG: [libc++] Fix append_range and prepend_range benchmarks (#216038)

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

Fixes #209499

Added: 
    

Modified: 
    libcxx/test/benchmarks/containers/sequence/sequence_container_benchmarks.h

Removed: 
    


################################################################################
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();
         }
       });


        


More information about the libcxx-commits mailing list