This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [RFC] Improve wordexp performance.
- From: OndÅej BÃlka <neleai at seznam dot cz>
- To: Carlos O'Donell <carlos at redhat dot com>
- Cc: libc-alpha at sourceware dot org
- Date: Wed, 13 May 2015 20:35:54 +0200
- 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>
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.
So I wont make microbenchmark as it would be useless exercise for pretty
obvious case.
You would need runtime profiling to get something useful.