[libcxx-commits] [libcxx] [libc++] Fix append_range and prepend_range benchmarks (PR #216038)
Louis Dionne via libcxx-commits
libcxx-commits at lists.llvm.org
Thu Aug 13 05:50:46 PDT 2026
https://github.com/ldionne created https://github.com/llvm/llvm-project/pull/216038
They were using clear(), which keeps the storage around, instead of starting over from an empty container.
Fixes #209499
>From a6cbb82f31bf99b36b232986c709adeae2d25373 Mon Sep 17 00:00:00 2001
From: Louis Dionne <ldionne.2 at gmail.com>
Date: Thu, 13 Aug 2026 08:39:33 -0400
Subject: [PATCH] [libc++] Fix append_range and prepend_range benchmarks
They were using clear(), which keeps the storage around, instead of
starting over from an empty container.
Fixes #209499
---
.../containers/sequence/sequence_container_benchmarks.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
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