[PATCH] Optimize strchr (x, 0)

Ondřej Bílka neleai@seznam.cz
Mon Mar 11 09:36:00 GMT 2013


On Sun, Mar 10, 2013 at 03:29:04AM +0600, Denis Zaitceff wrote:
> On Sat, Mar 9, 2013 at 8:39 PM, Ondřej Bílka <neleai@seznam.cz> wrote:
> > On Sat, Mar 09, 2013 at 07:48:02PM +0600, Denis Zaitceff wrote:
> >> On Sun, Feb 24, 2013 at 4:43 PM, Ondřej Bílka <neleai@seznam.cz> wrote:
> >> >
> >> > As strlen is more optimized than rawmemchr it will be more effective
> >> > than now. (If rawmemchr(x,0) is faster then it is performance regression of
> >> > strlen.)
> >>
> >> Why do you think it is more optimized?
> >
> > Test it. If you find architecture where rawmemchr/strchr is faster feel
> > free send patch like:
> >
> > size_t strlen(char *x)
> > {
> >         return strchr(x,0)-x;
> > }
> 
> Ok.  What exactly should I test - strlen and strchar from where?
> GCC's variants, ones from string2.h or manual asm-variants?

Assembly variants that will get used. However on x86-64 I have pending
patch that improves strlen so test it.



More information about the Libc-alpha mailing list