This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [RFC] Improve wordexp performance.
- From: "Carlos O'Donell" <carlos at redhat dot com>
- To: OndÅej BÃlka <neleai at seznam dot cz>
- Cc: libc-alpha at sourceware dot org
- Date: Wed, 13 May 2015 14:55:28 -0400
- Subject: Re: [RFC] Improve wordexp performance.
- Authentication-results: sourceware.org; auth=none
- References: <20150513124945 dot GA4067 at domone> <55538A90 dot 9000908 at redhat dot com> <20150513183554 dot GA31157 at domone>
On 05/13/2015 02:35 PM, OndÅej BÃlka wrote:
> On Wed, May 13, 2015 at 01:32:00PM -0400, Carlos O'Donell wrote:
>> On 05/13/2015 08:49 AM, OndÅej BÃlka wrote:
>>> Hi, as I read Paul's wordexp patch I found that you use inefficient
>>> idiom. Checking character membership with strchr is slow due to startup
>>> cost. Much better is just use table lookup.
>>
>> How did you test it was faster?
>>
> You don't need to look at barometer to see if its raining. It does
> single memory access which takes around 5-6 cycles is faster than strchr that takes ~30 cycles
> and cannot be faster as it also needs to do a memory access.
>
>
>> Could you please add a wordexp microbenchmark to show the gains?
>>
> I could. Its easy to make microbenchmark that shows improved performance.
> Also its easy to make microbenchmark that makes it a regression. Just
> use 128 byte IFS env. variable and call wordexp("x", foo, 0)
> I could also make microbenchmark that is inconclusive as performance
> difference is lost in syscall overhead of finding filenames by glob.
And those would all represent various workloads which we care about?
I'm fine having 3 different wordexp microbenchmarks.
> So I wont make microbenchmark as it would be useless exercise for pretty
> obvious case.
OK.
> You would need runtime profiling to get something useful.
I don't agree with that. I think a microbenchmark of wordexp would be useful
as a regression test for this case.
Cheers,
Carlos.