This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
RE: Optimized? strchr implementations.
- From: "Wilco Dijkstra" <wdijkstr at arm dot com>
- To: 'OndÅej BÃlka' <neleai at seznam dot cz>
- Cc: <libc-alpha at sourceware dot org>
- Date: Wed, 27 May 2015 12:47:11 +0100
- Subject: RE: Optimized? strchr implementations.
- Authentication-results: sourceware.org; auth=none
- References: <20150524150715 dot GA31589 at domone> <20150524163214 dot GA28053 at domone> <20150524171036 dot GA20947 at domone> <000b01d097ae$ca78c340$5f6a49c0$ at com> <20150526143854 dot GA24529 at domone>
> OndÅej BÃlka wrote:
> On Tue, May 26, 2015 at 01:23:36PM +0100, Wilco Dijkstra wrote:
> > > OndÅej BÃlka wrote:
> > > On Sun, May 24, 2015 at 06:32:14PM +0200, OndÅej BÃlka wrote:
> > > > Hi,
> > > > this is nontrivial optimization of string inlines.
> > > > First it decreases icache pressure as you don't need strchr.
> >
> > It's not obvious to me that is the right thing to do. Generally it is best
> > to use the standard C90/C99 functions rather than infrequently used
> > non-standard ones. A quick grep of GLIBC shows strchr is used a lot more
> > than strchrnul, and 9 targets have an optimized strchr vs 5 for strchrnul.
> >
> I looked at how architectures optimize strchr and that number is less.
>
> Some of these are not optimized implementations. If you do gcc
> string/strchr.c -S then you get assembly implementation. Several
> architectures don't exploit any hardware capabilities, just use same
> algorithm as generic so these could be deleted.
>
> I know that generic implementation could be improved and will post a
> patches.
Sounds good.
> Only two that are real optimizations and don't have strchnul are armv6
> and alpha
> So could you adapt armv6 one?
Yes that shouldn't be too hard - and looking at it, it seems feasible to
tweak some extra performance out of it as well.
Wilco