[libcxx-commits] [libcxx] [libc++] Implement single element vector::insert in terms of emplace (PR #210284)

Louis Dionne via libcxx-commits libcxx-commits at lists.llvm.org
Mon Aug 10 07:46:50 PDT 2026


================
@@ -375,10 +447,34 @@ void sequence_container_benchmarks(std::string container) {
             c.erase(c.end() - BatchSize, c.end());
           }
         });
+
+        bench("emplace_back() (with reserve)" + tostr(gen), [gen](auto& st) {
----------------
ldionne wrote:

As you noticed, we don't care about the number of elements already in the vector, since it's always constant time. We could probably benchmark this only for 8000 something elements.

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


More information about the libcxx-commits mailing list