[Bug libstdc++/88545] std::find compile to memchr in trivial random access cases (patch)
cvs-commit at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Fri Jul 5 11:19:56 GMT 2024
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88545
--- Comment #13 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:de19b516edbf919d31e9d22fdbf6066342d904a2
commit r15-1857-gde19b516edbf919d31e9d22fdbf6066342d904a2
Author: Jonathan Wakely <jwakely@redhat.com>
Date: Wed Jun 5 16:01:26 2024 +0100
libstdc++: Use memchr to optimize std::find [PR88545]
This optimizes std::find to use memchr when searching for an integer in
a range of bytes.
libstdc++-v3/ChangeLog:
PR libstdc++/88545
PR libstdc++/115040
* include/bits/cpp_type_traits.h (__can_use_memchr_for_find):
New variable template.
* include/bits/ranges_util.h (__find_fn): Use memchr when
possible.
* include/bits/stl_algo.h (find): Likewise.
* testsuite/25_algorithms/find/bytes.cc: New test.
More information about the Gcc-bugs
mailing list