This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc 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]

RE: Optimized? strchr implementations.


> 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



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