[libcxx-commits] [libcxx] [libc++] fix minor performance issue in `basic_string<C>::append()` (PR #210078)
Louis Dionne via libcxx-commits
libcxx-commits at lists.llvm.org
Tue Jul 21 05:07:30 PDT 2026
================
@@ -482,6 +483,41 @@ int main(int argc, char** argv) {
std::bind_front(bench_impl, std::integral_constant<size_t, large_size>{}, std::false_type{}));
}
+ {
+ static auto bench_impl =
+ []<size_t size, bool opaque, class CharT>(
+ std::integral_constant<size_t, size>,
+ std::bool_constant<opaque>,
+ std::type_identity<CharT>,
+ benchmark::State& state) {
+ std::basic_string<CharT> src(size, 'a');
+ auto getIterator = [&src](size_t i) {
+ // INT_MAX because we want overhead of ThrowingIterator without actually throwing
+ return ThrowingIterator<CharT>(src.data() + i, src.data() + src.size(), INT_MAX);
----------------
ldionne wrote:
@toughengineer Do you have thoughts about this?
https://github.com/llvm/llvm-project/pull/210078
More information about the libcxx-commits
mailing list