[Bug libstdc++/124463] [15/16 Regression] Big (10x) performance regression for std::deque<unsigned char>
cvs-commit at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Tue Mar 17 22:07:11 GMT 2026
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=124463
--- Comment #7 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jonathan Wakely <redi@gcc.gnu.org>:
https://gcc.gnu.org/g:892451e7b6aa50a19d094045c28d4d53d26d2929
commit r16-8142-g892451e7b6aa50a19d094045c28d4d53d26d2929
Author: Jonathan Wakely <jwakely@redhat.com>
Date: Fri Mar 13 17:11:04 2026 +0000
libstdc++: Optimize __uninitialized_copy_a for std::deque iterators
[PR124463]
I reimplemented uninitialized_copy and uninitialized_move in
r15-4473-g3abe751ea86e34 so that they no longer delegate to std::copy,
but that meant that they were no longer optimized for std::deque
iterators, leading to performance regressions for operations on a
std::deque with trivial element types. This adds new overloads of
__uninitialized_copy_a and __uninitialized_move_a to handle std::deque
iterators, restoring the lost performance.
There are also overloads of std::fill for deque iterators which are no
longer used for std::uninitialized_fill. This does not add replacements
for those, so there will still be lost performance for std::deque
operations that depend on std::uninitialized_fill. Similarly, inserting
or assigning from istreambuf_iterator into a std::deque no longer uses
the std::copy overloads for those types, and that isn't fixed by this
patch either.
libstdc++-v3/ChangeLog:
PR libstdc++/124463
* include/bits/deque.tcc (__uninitialized_copy_a): Define
overloads for input and output iterators being std::deque
iterators, and for only the output iterator being a std::deque
iterator.
(__uninitialized_move_a): Overload for input and output
iterators being std::deque iterators.
* include/bits/stl_uninitialized.h (__uninitialized_copy_a)
(__uninitialized_move_a): Declare overloads for std::deque
iterators.
Reviewed-by: Tomasz KamiÅski <tkaminsk@redhat.com>
More information about the Gcc-bugs
mailing list