Re: Performance issue of 'git branch'
- From
- Carlos R. Mafra <crmafra2@gmail.com>
- Date
- Jul 23, 2009, 03:18 UTC
- Message-ID
- <20090723031843.GA9152@Pilar.aei.mpg.de>
- In-Reply-To
- <alpine.LFD.2.01.0907221921570.3352@localhost.localdomain>
First of all:
* yes, my VAIO has a slow 4200 rpm disc :-(
* strace -T indeed showed that lstat() was not guilty
* GIT_DEBUG_LOOKUP=1 git branch produced ugly 2200+ linesNow to the patch,
On Wed 22.Jul'09 at 19:23:39 -0700, Linus Torvalds wrote:
Show 10 quoted lines
> > Ooh yes. That would do it. It's going to peel and look up every single ref > > it finds, so it's going to look up _hundreds_ of objects (all the tags, > > all the commits they point to, etc etc). Even if it then only shows a > > couple of branches. > > > > Junio, any ideas? > > I had one of my own. > > Does this fix it?
Yes!
[mafra@Pilar:linux-2.6]$ time git branch 27-stable 28-stable 29-stable 30-stable dev-private * master option sparse stern 0.00user 0.01system 0:01.50elapsed 1%CPU (0avgtext+0avgdata 0maxresident)k 0inputs+0outputs (42major+757minor)pagefaults 0swaps
01.50 is not that good, but it doesn't "feel" terrible as 4 seconds. [ It is incredible how 4 secs feels really bad while 2 is acceptable... ]
So thank you very much, Linus! A 50% improvement here!
And I am happy to have finally reported it, after quietly suffering for so long thinking that "git is as fast as possible, so it is probably my fault".
PS: Out of curiosity, how many femtoseconds does it take in your state-of-the-art machine? :-)