Hello Brice, Brice Figureau schrieb am Mon 13. Oct, 10:15 (+0200): > On Mon, 2008-10-13 at 00:53 +0000, JÃrg Sommer wrote: > > > * this shell array is then passed to _multi_parts for path splitting of > > > each element. This is this operation that takes age. As soon as I change > > > the _multi_parts code to just call a naive compadd and return, the > > > completion is (almost) immediate, and seems to work fine. > > > > Can you try this patch? It doesn't change anything if you didn't specify > > anything, i.e. git log -- <TAB> takes still very long. But it optimizes > > the case when you specify anything. Try git log -- some/thing<TAB>. > > [snipped patch] > > Yes, that works way faster for this case. Unfortunately it doesn't seem > to report the right results: I've forgot to put the result back in an array. Try this patch: commit e8536069c36e8ae310e249356274a398bf5bd38d Author: JÃrg Sommer <joerg@xxxxxxxxxxxx> Date: Mon Oct 13 01:58:03 2008 +0200 Prefilter the completion for _multi_parts The _multi_parts function consumes very much time, if the array with the possible completions is large. This happens often in large git repositories like the kernel git repository. To reduce the workload of _multi_parts filter out does entries from the array, they aren't possible completions. When the user specifies the path foo/bar only consider paths matching the pattern foo*/bar*. diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git index c617613..b6f5297 100644 --- a/Completion/Unix/Command/_git +++ b/Completion/Unix/Command/_git @@ -2761,6 +2761,7 @@ __git_files () { files=(${(ps:\0:)"$(_call_program files git ls-files -z $ls_opts $opts 2>/dev/null)"}) __git_command_successful || return + [[ -n $PREFIX ]] && files=(${(M)files:#${~PREFIX//\//*/}*}) _wanted files expl 'index file' _multi_parts $@ - / files } @@ -2859,6 +2860,7 @@ __git_tree_files () { fi local expl + [[ -n $PREFIX ]] && tree_files=(${(M)tree_files:#${~PREFIX//\//*/}*}) _wanted files expl 'tree file' _multi_parts -f $@ -- / tree_files } Bye, JÃrg. -- ObjektivitÃt ist die Wahnvorstellung, Beobachtungen kÃnnten ohne Beobachter gemacht werden â Heinz v. Foerster
Attachment:
signature.asc
Description: Digital signature http://en.wikipedia.org/wiki/OpenPGP