Re: Performance issue of 'git branch'
- From
Linus Torvalds <torvalds@linux-foundation.org>
- Date
- Jul 23, 2009, 03:08 UTC
- Message-ID
- <alpine.LFD.2.01.0907221959330.21520@localhost.localdomain>
- In-Reply-To
- <alpine.LFD.2.01.0907221921570.3352@localhost.localdomain>
On Wed, 22 Jul 2009, Linus Torvalds wrote:
Show 7 quoted lines
> > It uses the "raw" version of 'for_each_ref()' (which doesn't verify that > the ref is valid), and then does the "type verification" before it starts > doing any gentle commit lookup. > > That should hopefully mean that it no longer does tons of object lookups > on refs that it's not actually interested in.
Hmm. On my kernel repo, doing
GIT_DEBUG_LOOKUP=1 git branch | wc -l
I get - before: 2121 - after: 39
(where two of the lines are the actual 'git branch' output). So yeah, this should make a big difference. It now looks up just two objects (one of them duplicated because it checks "HEAD" - but the duplicate lookup won't result in any extra IO, so it's only two _uncached_ accesses).
The GIT_DEBUG_LOOKUP debug output probably does match the number of cold-cache IO's fairly well for something like this (at least to a first approximation), so I really hope my patch will fix your problem.
Linus