This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
RE: [PATCH 4/*] Generic string memchr and strnlen
- From: "Wilco Dijkstra" <wdijkstr at arm dot com>
- To: 'OndÅej BÃlka' <neleai at seznam dot cz>
- Cc: "Chris Metcalf" <cmetcalf at ezchip dot com>, "'GNU C Library'" <libc-alpha at sourceware dot org>
- Date: Wed, 12 Aug 2015 17:46:57 +0100
- Subject: RE: [PATCH 4/*] Generic string memchr and strnlen
- Authentication-results: sourceware.org; auth=none
- References: <20150724170425 dot GA10041 at domone> <003d01d0c63b$0080b730$01822590$ at com> <20150724191248 dot GA2889 at domone> <004201d0c873$bd3b9fe0$37b2dfa0$ at com> <20150727165642 dot GA22842 at domone> <55B67BA7 dot 7030606 at ezchip dot com> <20150727232224 dot GA21851 at domone> <004b01d0c936$5f6ed3a0$1e4c7ae0$ at com> <20150812051245 dot GA16265 at domone> <005201d0d505$78b0cd70$6a126850$ at com> <20150812140702 dot GA21326 at domone>
> OndÅej BÃlka wrote:
> On Wed, Aug 12, 2015 at 02:47:46PM +0100, Wilco Dijkstra wrote:
> > > OndÅej BÃlka wrote:
> > > On Tue, Jul 28, 2015 at 02:07:35PM +0100, Wilco Dijkstra wrote:
> > > > > OndÅej BÃlka wrote:
> > > > > On Mon, Jul 27, 2015 at 02:42:47PM -0400, Chris Metcalf wrote:
> > > > > > On 07/27/2015 12:56 PM, OndÅej BÃlka wrote:
> >
> > > Then could you review a generic patch that I am about to ping?
> >
> > Do you mean https://sourceware.org/ml/libc-alpha/2015-08/msg00443.html?
> > I don't see a patch attached...
> >
> I wrote it long ago, here:
> https://sourceware.org/ml/libc-alpha/2013-10/msg00201.html
How often is strrchr used to search for zero? What about this alternative?
size_t n = strlen (s);
if (c == 0)
return s + n;
return __memrchr (s, c, n);
> > Still bench-strrchr.c needs to be updated to use realistic inputs so people can
> > optimize for the right dataset.
>
> depends how you do that, you could now use as benchmark
>
> ./testrun.sh dryrun/bin/bench_strrchr -u
>
> I could sync benchmarks to use that benchmark, it depends on preference
> if we use that or keep it as separate project.
As of today the benchtests are still the official benchmarks. So if the patch
doesn't show a gain on the existing bench-strrchr.c, you need to add extra
inputs that show why this is a good idea. We don't need a full trace, just
a few typical cases plus maybe your worst-case example.
Wilco