Re: [PATCH] describe: Don’t look up commits with --exact-match
From: Jonathan Nieder <hidden>
Date: 2016-06-15 22:50:11
Anders Kaseorg wrote:
On Fri, 3 Dec 2010, Jonathan Nieder wrote:
quoted
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.
quoted
quoted
- 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?