Quoting Johannes Schindelin <Johannes.Schindelin@xxxxxx>:
Hi Gábor,
On Sat, 13 Feb 2016, SZEDER Gábor wrote:
$ cur=m ; time __gitcomp_nl "$(__git_refs '' 1)"
real 0m7.641s
user 0m5.888s
sys 0m1.832s
Using 'refname:strip=2' for both 'git for-each-ref' in __git_refs():
$ cur=m ; time __gitcomp_nl "$(__git_refs '' 1)"
real 0m2.848s
user 0m2.308s
sys 0m0.596s
I timed this one using a version that already included one from those
"few more tricks", so the change from ':short' to ':strip=2' alone
doesn't bring quite as much:
$ cur=m ; time __gitcomp_nl "$(__git_refs '' 1)"
real 0m3.645s
user 0m3.140s
sys 0m0.588s
Quick'n'dirty PoC using 'refname:strip', '**' globbing and a few more
tricks to let 'git for-each-ref' do the filtering instead of the
shell loop behind __gitcomp_nl():
$ cur=m ; time IFS=$'\n' COMPREPLY=( $(__git_refs_PoC '' 1) )
real 0m0.247s
user 0m0.208s
sys 0m0.032s
And this one now looks like:
$ cur=m ; time __gitcomp_direct "$(__git_refs_PoC '' 1)"
The timing results are the same.
May I have that patch, please? ;-)
It's early days, and when I say proof of concept I mean it :)
For now it only works for refs from the local repository, and only
when the ref to be completed is on its own on the command line (i.e.
not for 'git log master..<TAB>' or 'commit --fixup=<TAB>'), and the
trailing space is hardcoded, and ... though, arguably, that already
covers the majority of the cases. I only switched 'git checkout' to
use this optimized version, because that was the worst offender.
So I won't send patches to the list just now, but you or anyone
interested can take a peek at:
https://github.com/szeder/git.git completion-PoC-refs-speedup
Maybe even run some numbers on Windows?
Gábor
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html