From: Junio C Hamano Date: Thu, 23 Jul 2009 04:40:36 GMT Subject: Re: Performance issue of 'git branch' Message-ID: <7vtz146mgr.fsf@alter.siamese.dyndns.org> In-Reply-To: Linus Torvalds writes: > On Wed, 22 Jul 2009, Linus Torvalds wrote: >> >> 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. It seems that I missed all the fun while going out to dinner. > 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. Hmm, we now have to remember what this patch did, if we ever wanted to introduce negative refs later (see ef06b91 do_for_each_ref: perform the same sanity check for leftovers., 2006-11-18). Not exactly nice to spread the codepaths that need to be updated. Is the cold cache performance of "git branch" to list your local branches that important?