This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: strstr benchtest.
- From: OndÅej BÃlka <neleai at seznam dot cz>
- To: Florian Weimer <fweimer at redhat dot com>
- Cc: libc-alpha at sourceware dot org
- Date: Thu, 14 May 2015 12:41:04 +0200
- Subject: Re: strstr benchtest.
- Authentication-results: sourceware.org; auth=none
- References: <20150512205311 dot GA24057 at domone> <20150512210946 dot GB24057 at domone> <55546C06 dot 6060304 at redhat dot com>
On Thu, May 14, 2015 at 11:33:58AM +0200, Florian Weimer wrote:
> On 05/12/2015 11:09 PM, OndÅej BÃlka wrote:
> > Main problem of current benchtest was very biased input. I replaced that
> > with randomly generated ones that are closer to average case.
>
> But strstr is not run on random strings.
>
> Is there some easy way to generated traces of actual strstr arguments
> from a running system, perhaps using Systemtap?
>
Use my profiler here.
http://kam.mff.cuni.cz/~ondra/benchmark_string/strstr_profile250813.tar.bz2
But it won't help you much with this case. Haystacks are really short,
61% of calls end with match in first 16 bytes. See:
http://kam.mff.cuni.cz/~ondra/benchmark_string/profile/results/result.html strstr function
or
http://kam.mff.cuni.cz/~ondra/benchmark_string/i7_ivy_bridge/strstr_profile/results_gcc/result.html
While its extremely valuable information and you should focus to
optimize header it would probably report little change as both
implementations just do initial strchr.
Longer strings where you could see improvement don't exist in practice.
So you are left with generating some data.