Re: [PATCH 1/2] completion: improve ls-files filter performance
- From
Johannes Schindelin <johannes.schindelin@gmx.de>
- Date
- Mar 19, 2018, 17:12 UTC
- Message-ID
- <nycvar.QRO.7.76.6.1803191802140.55@ZVAVAG-6OXH6DA.rhebcr.pbec.zvpebfbsg.pbz>
- In-Reply-To
- <1521274624-1370-1-git-send-email-drizzd@gmx.net>
Hi drizzd,
first of all: thank you so much for working on this. I am sure it will be noticeable to many Windows users, and also make my life easier.
On Sat, 17 Mar 2018, Clemens Buchacher wrote:
Show 21 quoted lines
> From the output of ls-files, we remove all but the leftmost path > component and then we eliminate duplicates. We do this in a while loop, > which is a performance bottleneck when the number of iterations is large > (e.g. for 60000 files in linux.git). > > $ COMP_WORDS=(git status -- ar) COMP_CWORD=3; time _git > > real 0m11.876s > user 0m4.685s > sys 0m6.808s > > Using an equivalent sed script improves performance significantly: > > $ COMP_WORDS=(git status -- ar) COMP_CWORD=3; time _git > > real 0m1.372s > user 0m0.263s > sys 0m0.167s > > The measurements were done with mingw64 bash, which is used by Git for > Windows.
Technically, it is not the *mingw64* bash, but it is an MSYS2 Bash. This does make a little bit of a difference because of the penalty incurred by the POSIX emulation layer provided by the MSYS2 runtime.
(And it also addresses Gabór's question whether you ran the test suite, I guess... it takes multiple hours to run it even once on a regular computer.)
Ciao, Dscho