[RFC] Improve wordexp performance.
Carlos O'Donell
carlos@redhat.com
Wed May 13 19:54:00 GMT 2015
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.
More information about the Libc-alpha
mailing list