On Wed, 22 Jul 2009, Linus Torvalds wrote:
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.
I submitted essentially the same patch in May:
http://article.gmane.org/gmane.comp.version-control.git/120097
with the additional optimization that we don’t need to lookup commits at
all unless we’re using -v, --merged, --no-merged, or --contains. In my
tests, it makes `git branch` 5 times faster on an uncached linux-2.6
repository.
Anders