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

Re: Sha1 lookup and GIT_USE_LOOKUP

From
MPMarc Pegon <pegon.marc@gmail.com>
Date
Jun 9, 2011, 09:24 UTC
Message-ID
<BANLkTi=b+WKy2_9VeEw5B0QqodHfVJs2XQ@mail.gmail.com>
In-Reply-To
<7v62og2lw1.fsf@alter.siamese.dyndns.org>
On Wed, Jun 8, 2011 at 8:55 PM, Junio C Hamano <gitster@pobox.com> wrote:
Show 19 quoted lines
> Marc Pegon <pegon.marc@gmail.com> writes:
>
>> Since this environment variable is not set by default, git will always
>> use a simple binary search, won't it ?
>
> Yes.
>
>> Also, when searching for a sha1 given a sha1 prefix, among packed
>> objects, find_short_packed_object also does a simple binary search.
>> Wouldn't it be simpler to just use the sha1_entry_pos method ?
>
> Unknown ;-).
>
> The environment variable is there exactly for people like you who are
> interested in finding out which one yields better performance by
> benchmarking.  Once we can get a convincing result, we can either
> deprecate the more involved sha1_entry_pos() if it turns out to be not
> worth it, or we can always use it if it turns out to be significantly
> better.

Perhaps we could compare the two methods by counting for each one the average number of iterations it takes to find an object in a pack. But anyways, I guess GIT_USE_LOOKUP should also have an influence on the method used to find an object given a sha1 prefix, and the code that does a simple binary search should not be duplicated as it is now, right ?

> Thanks.
>
Previous: Junio C HamanoNext: Michael Schubert
Message 3 of 4 in “Sha1 lookup and GIT_USE_LOOKUP”
  1. Marc PegonJun 8, 2011
  2. Junio C HamanoJun 8, 2011
  3. Marc PegonJun 9, 2011
  4. Michael SchubertJun 9, 2011

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.