This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [GLIBC][PATCH] Remove strcmp inlines
On Mon, Dec 12, 2016 at 7:11 AM, Wilco Dijkstra <Wilco.Dijkstra@arm.com> wrote:
> Remove the str(n)cmp inlines from string/bits/string2.h. The strncmp
> optimization seems unlikely to ever be useful, but if it occurs in
> real code it should be added to GCC. Expanding strcmp of small strings
> does appear useful (benchmarking shows it is 2-3x faster), so this would
> be useful to implement in GCC.
I'm inclined to say that the strcmp expansion should stick around
until after it _is_ added to GCC. Code such as
int main(int argc, char **argv)
{
return (argc == 2 &&
(!strcmp(argv[1], "-w") ||
!strcmp(argv[1], "-x") ||
!strcmp(argv[1], "-z") ||
!strcmp(argv[1], "-t")));
}
is reasonably likely to appear in real life and is significantly
improved by the expansion.
zw