git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] describe: Don’t look up commits with --exact-match

From
Jonathan Nieder <jrnieder@gmail.com>
Date
Dec 6, 2010, 07:32 UTC
Message-ID
<20101206073214.GA3745@burratino>
In-Reply-To
<alpine.DEB.2.02.1012060149550.23348@dr-wily.mit.edu>
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.
Show 8 quoted lines
>>> -	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?

Previous: Anders KaseorgNext: Thomas Rast
Message 5 of 28 in “describe: Don’t look up commits with --exact-match”
  1. describe: Don’t look up commits with --exact-matchAnders Kaseorg, Nov 17, 2010
  2. Jonathan NiederDec 3, 2010
  3. Anders KaseorgDec 6, 2010
  4. describe: Don’t look up commits with --exact-matchAnders Kaseorg, Dec 6, 2010
  5. Jonathan NiederDec 6, 2010
  6. Thomas RastDec 6, 2010
  7. Anders KaseorgDec 6, 2010
  8. Jonathan NiederDec 6, 2010
  9. SZEDER GáborDec 7, 2010
  10. 1/2 describe: Use for_each_rawrefAnders Kaseorg, Dec 7, 2010
  11. 2/2 describe: Don’t look up commits with --exact-matchAnders Kaseorg, Dec 7, 2010
  12. Anders KaseorgDec 7, 2010
  13. Junio C HamanoDec 7, 2010
  14. Junio C HamanoDec 7, 2010
  15. Junio C HamanoDec 7, 2010
  16. Anders KaseorgDec 8, 2010
  17. 1/4 describe: Use for_each_rawrefAnders Kaseorg, Dec 8, 2010
  18. 2/4 describe: Don’t use a flex array in struct commit_nameAnders Kaseorg, Dec 8, 2010
  19. 3/4 describe: Store commit_names in a hash table by commit SHA1Anders Kaseorg, Dec 8, 2010
  20. 3/4 describe: Store commit_names in a hash table by commit SHA1Anders Kaseorg, Dec 8, 2010
  21. Junio C HamanoDec 8, 2010
  22. 4/4 describe: Delay looking up commits until searching for an inexact matchAnders Kaseorg, Dec 8, 2010
  23. Junio C HamanoDec 8, 2010
  24. Anders KaseorgDec 8, 2010
  25. 1/4 describe: Use for_each_rawrefAnders Kaseorg, Dec 9, 2010
  26. 2/4 describe: Don’t use a flex array in struct commit_nameAnders Kaseorg, Dec 9, 2010
  27. 3/4 describe: Store commit_names in a hash table by commit SHA1Anders Kaseorg, Dec 9, 2010
  28. 4/4 describe: Delay looking up commits until searching for an inexact matchAnders Kaseorg, Dec 9, 2010

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.