From: Jonathan Nieder Date: Mon, 06 Dec 2010 07:32:14 GMT Subject: Re: [PATCH] describe: Don’t look up commits with --exact-match Message-ID: <20101206073214.GA3745@burratino> In-Reply-To: Anders Kaseorg wrote: > On Fri, 3 Dec 2010, Jonathan Nieder wrote: >> Instead of looking up the commit to be matched exactly in the commits >> hash table, this makes a linear search. [...] > I don’t think it’s ever a problem: in my repository with 1800 tags on a > warm cache, that loop accounts for about 0.1% of even the fastest > non-exact-match query (a commit right after a tag). Thanks for checking. Makes sense. >>> - for_each_ref(get_name, NULL); >>> + for_each_rawref(get_name, NULL); >> >> Orthogonal change snuck in? > > This does fall under the category of “Don’t lookup commits,” and is > necessary to get the speedup (otherwise for_each_ref has already looked up > the commits that the rest of the patch is trying to avoid looking up). Depends on what "Don't lookup commits" means, I suppose. I think the difference between _ref and _rawref is if (!(flags & DO_FOR_EACH_INCLUDE_BROKEN)) { if (entry->flag & REF_BROKEN) return 0; /* ignore dangling symref */ if (!has_sha1_file(entry->sha1)) { error("%s does not point to a valid object!", entry->name); return 0; } } so if I understand correctly, for_each_ref would still allow one to get away without unpacking the objects. Is that correct?