This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug libstdc++/62187] std::string==const char* could compare sizes first


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

--- Comment #6 from Marc Glisse <glisse at gcc dot gnu.org> ---
Ignoring strange specializations of char_traits, we could also consider a
specialized version of memcmp/strncmp that checks for a terminating 0 in only
one of the 2 strings. This would avoid the call to strlen when the 2 strings
are long but differ early, but on average it would probably turn out slower
than the well optimized strlen+memcmp from libc.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]