This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
RE: [PATCH] Use strlen when searching for a nul char
- From: "Wilco Dijkstra" <wdijkstr at arm dot com>
- To: <pinskia at gmail dot com>
- Cc: "GNU C Library" <libc-alpha at sourceware dot org>
- Date: Wed, 7 Oct 2015 15:50:00 +0100
- Subject: RE: [PATCH] Use strlen when searching for a nul char
- Authentication-results: sourceware.org; auth=none
- References: <003a01d1010c$ad404240$07c0c6c0$ at com> <5F638E7C-B8BD-4F94-8278-1F8B359CACCA at gmail dot com>
> pinskia@gmail.com wrote:
> > On Oct 7, 2015, at 7:30 AM, Wilco Dijkstra <wdijkstr@arm.com> wrote:
> >
> > Expand strchr (s, '\0') in C/C++ to use strlen. This is faster on most targets as strlen is
> a
> > simpler function. Passes GLIBC tests. I'm planning to do the same for strrchr, strchrnul and
> > rawmemchr in future patches as people frequently use all of these to find the end of a
> string.
> >
> > OK for commit?
>
> Shouldn't this also be an optimization inside gcc if not already?
Absolutely, GCC is missing many of these simple optimizations.
Wilco