This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PING][PATCH] More effective generic strrchr.
- From: OndÅej BÃlka <neleai at seznam dot cz>
- To: Richard Earnshaw <rearnsha at arm dot com>
- Cc: "libc-alpha at sourceware dot org" <libc-alpha at sourceware dot org>
- Date: Sun, 7 Jun 2015 15:38:19 +0200
- Subject: Re: [PING][PATCH] More effective generic strrchr.
- Authentication-results: sourceware.org; auth=none
- References: <20131005071542 dot GA13382 at domone> <20150107115537 dot GA31981 at domone> <54AD213F dot 2060907 at arm dot com>
On Wed, Jan 07, 2015 at 12:06:23PM +0000, Richard Earnshaw wrote:
> On 07/01/15 11:55, OndÅej BÃlka wrote:
> > [PING]
>
> Looks sensible to me.
>
> It would be useful if some of the bench tests were based on degenerate
> examples.
>
> R.
>
Sorry that I didn't originally noticed this mail until I returned to
strrchr again. I commented that benchmark is pretty meaningless as
performance depends on empirical variable and each implementation could
be best with it suitably choosen.
Here its average number of occurences of c, if thats close to zero then
strchr would be faster in just finding terminating zero. You need to
have one c on average for this be worthwhile.
As my test data I used start of glibc make. That shows most strrchr
calls. These with test that replays these with same pattern of c matches
is here.
http://kam.mff.cuni.cz/~ondra/dryrun_strrchr.tar.bz2
It shows considerable speedup, I don't know exactly yet as I need to
subtract construction overhead.