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: [PATCH 4/*] Generic string memchr and strnlen


> 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




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