[Bug libstdc++/62187] std::string==const char* could compare sizes first
glisse at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Tue Jan 24 15:41:00 GMT 2017
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.
More information about the Gcc-bugs
mailing list