Re: [PATCH] builtins: search builtin commands via binary search.

2013-07-29 Thread Junio C Hamano
Stefan Beller writes: > However I could not find a speedup. > So if the patch is accepted, it would only be for readability. This adds a maintenance burden. It is very easy for somebody to mistakenly run "sort" on the region in her editor under non C locale. Perhaps with a change like the atta

Re: [PATCH] builtins: search builtin commands via binary search.

2013-07-28 Thread Eric Sunshine
On Sat, Jul 27, 2013 at 4:49 AM, Stefan Beller wrote: > I was fiddling around with make now to include the suggestion of Eric to > check the arguments for being sorted in make. However I do not > seem to fully understand the syntax yet. > My approach would have been: > > sorted_internal_cmds: git.

Re: [PATCH] builtins: search builtin commands via binary search.

2013-07-27 Thread Andreas Schwab
Stefan Beller writes: > My approach would have been: > > sorted_internal_cmds: git.c > { awk '/cmd_struct commands/,/};/ { if (match($2,/"/)) print $2 }' > builtin.actual && \ > sort builtin.expect && \ > cmp -s builtin.expect builtin.actual && \ > rm builtin.expect built

Re: [PATCH] builtins: search builtin commands via binary search.

2013-07-27 Thread Stefan Beller
On 07/26/2013 10:57 PM, Jonathan Nieder wrote: > Hi, > > Stefan Beller wrote: > >> --- a/git.c >> +++ b/git.c >> @@ -309,9 +309,18 @@ static int run_builtin(struct cmd_struct *p, int argc, >> const char **argv) >> return 0; >> } >> >> +static int compare_internal_command(const void *a, c

Re: [PATCH] builtins: search builtin commands via binary search.

2013-07-26 Thread Eric Sunshine
On Fri, Jul 26, 2013 at 4:50 PM, Stefan Beller wrote: > There are currently 115 commands built into the git executable. > Before this commit, it was iterated over these commands in a linear > order, i.e. each command was checked. > > As it turns out the commands are already sorted alphabetically,

Re: [PATCH] builtins: search builtin commands via binary search.

2013-07-26 Thread Jonathan Nieder
Hi, Stefan Beller wrote: > --- a/git.c > +++ b/git.c > @@ -309,9 +309,18 @@ static int run_builtin(struct cmd_struct *p, int argc, > const char **argv) > return 0; > } > > +static int compare_internal_command(const void *a, const void *b) { > + /* The first parameter is of type char