https://gcc.gnu.org/bugzilla/show_bug.cgi?id=23112

Fangrui Song <maskray at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |maskray at gcc dot gnu.org

--- Comment #2 from Fangrui Song <maskray at gcc dot gnu.org> ---
basic_string::rfind(const CharT*, size_type, size_type) and
basic_string_view::rfind still call traits_type::compare (memcmp) on the
whole needle at every position from __pos down to 0.

find was changed by r244225 (PR 66414) and r11-6931 to skip ahead with
traits_type::find (memchr) for the first character, but rfind was never
updated.

This shows up in LLVM, where StringRef::rfind forwards to
std::string_view::rfind and the linker calls rfind(".llvm.") and similar
on millions of symbol names. LLVM is now considering a hand-written
replacement because of it: https://github.com/llvm/llvm-project/pull/242215

Reply via email to