[libcxx-commits] [libcxx] [libc++] Optimize basic_string::append(Iter, Iter) (PR #169794)

Louis Dionne via libcxx-commits libcxx-commits at lists.llvm.org
Tue Dec 2 09:18:03 PST 2025


================
@@ -122,6 +125,26 @@ static void BM_StringResizeAndOverwrite(benchmark::State& state) {
 }
 BENCHMARK(BM_StringResizeAndOverwrite);
 
+template <class Container>
+static void BM_StringAppend(benchmark::State& state) {
+  std::string orig_str = "This is some data so the string isn't empty";
+  std::string str = orig_str;
+
+  const char to_append_str[] = "This is a long string to make sure append does some work";
+  Container to_append;
----------------
ldionne wrote:

```suggestion
  Container to_append(std::begin(to_append_str), std::end(to_append_str));
```

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


More information about the libcxx-commits mailing list